Click here to Skip to main content
15,882,055 members
Home / Discussions / C#
   

C#

 
AnswerRe: loading form 1 after the other Pin
MoustafaS4-May-07 12:36
MoustafaS4-May-07 12:36 
AnswerRe: loading form 1 after the other Pin
Arun.Immanuel4-May-07 16:12
Arun.Immanuel4-May-07 16:12 
AnswerRe: loading form 1 after the other Pin
AFSEKI7-May-07 3:13
AFSEKI7-May-07 3:13 
Questionhow to align the label controls in group box according to their text size Pin
engsrini4-May-07 10:35
engsrini4-May-07 10:35 
QuestionComboBox ... Pin
mostafa_h4-May-07 8:44
mostafa_h4-May-07 8:44 
AnswerRe: ComboBox ... Pin
AFSEKI7-May-07 3:14
AFSEKI7-May-07 3:14 
QuestionDesktop icon positioning/re-positioning... Pin
SeanWcom4-May-07 8:20
SeanWcom4-May-07 8:20 
AnswerRe: Desktop icon positioning/re-positioning... Pin
Luc Pattyn4-May-07 8:53
sitebuilderLuc Pattyn4-May-07 8:53 
Hi,


this is a very complex matter, that involves many P/Invoke functions, and consists
of the following steps:

1. find the handle to the listview: in Windows XP the desktop is a listview; to get there,
you must descend the chain "Progman", "SHELLDLL_DefView", "SysListView32".

2. for each of the icons, send an LVM_GETITEMPOSITION or LVM_SETITEMPOSITION message.
Since the message goes to another process and requires a data pointer, that data pointer
must be valid in the other process, so you must first allocate memory in that process.
You will probably need the following prototypes:

[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern int OpenProcess(uint access, bool inheritHandle,
    uint procID);

[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool CloseHandle(int handle);

[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern IntPtr VirtualAllocEx(int hProcess, int address,
    int size, uint allocationType, uint protection);

[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool VirtualFreeEx(int hProcess, IntPtr address,
    int size, uint freeType);

[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool WriteProcessMemory(int hProcess,
    IntPtr otherAddress, IntPtr localAddress, int size,
    ref uint bytesWritten);

[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool ReadProcessMemory(int hProcess,
    IntPtr otherAddress, IntPtr localAddress, int size,
    ref uint bytesRead);

[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool ReadProcessMemory(int hProcess,
    IntPtr otherAddress, StringBuilder localAddress, int size,
    ref uint bytesRead);


Then there will appear one major problem: moving an icon to a position that is occupied
makes Explorer reshuffle a lot of icons; so dont expect to easily get the layout you hope.

If you succeed, please let me know !

Smile | :)






Luc Pattyn

[My Articles]

GeneralRe: Desktop icon positioning/re-positioning... Pin
SeanWcom4-May-07 9:39
SeanWcom4-May-07 9:39 
AnswerRe: Desktop icon positioning/re-positioning... Pin
AFSEKI7-May-07 3:17
AFSEKI7-May-07 3:17 
GeneralRe: Desktop icon positioning/re-positioning... Pin
SeanWcom7-May-07 3:21
SeanWcom7-May-07 3:21 
QuestionCreate ToolBar? Pin
god4k4-May-07 8:14
god4k4-May-07 8:14 
Questionnetwork Pin
Jeeva Jose4-May-07 7:15
Jeeva Jose4-May-07 7:15 
AnswerRe: network Pin
Dave Kreskowiak4-May-07 7:58
mveDave Kreskowiak4-May-07 7:58 
AnswerRe: network Pin
Ian Shlasko4-May-07 8:11
Ian Shlasko4-May-07 8:11 
GeneralRe: network Pin
Paul Conrad4-May-07 16:20
professionalPaul Conrad4-May-07 16:20 
Questionhow to execute another application thru C#? Pin
Eddymvp4-May-07 5:54
Eddymvp4-May-07 5:54 
AnswerRe: how to execute another application thru C#? Pin
Arun.Immanuel4-May-07 6:05
Arun.Immanuel4-May-07 6:05 
AnswerRe: how to execute another application thru C#? Pin
Paul Conrad4-May-07 13:54
professionalPaul Conrad4-May-07 13:54 
AnswerRe: how to execute another application thru C#? Pin
AFSEKI7-May-07 3:20
AFSEKI7-May-07 3:20 
GeneralRe: how to execute another application thru C#? Pin
Eddymvp7-May-07 3:22
Eddymvp7-May-07 3:22 
QuestionCrystal Report Deploying problem Pin
Nermeenez4-May-07 4:24
Nermeenez4-May-07 4:24 
AnswerRe: Crystal Report Deploying problem Pin
Tarakeshwar Reddy4-May-07 4:37
professionalTarakeshwar Reddy4-May-07 4:37 
QuestionSecure Web Service with C# DataSource Pin
Andre Vianna4-May-07 4:22
Andre Vianna4-May-07 4:22 
QuestionDisapear sln Pin
sujithkumarsl4-May-07 3:46
sujithkumarsl4-May-07 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.