Home > Software engineering >  A desktop icon position for c code, the great god can give with vb or call can be made into TLB
A desktop icon position for c code, the great god can give with vb or call can be made into TLB

Time:09-17


Typedef struct tagLVITEM64
{
UINT mask;
Int iItem.
Int iSubItem;
UINT state;
UINT stateMask;
_int64 pszText;
Int cchTextMax;
Int iImage;
_int64 lParam;
# if (_WIN32_IE & gt;=0 x0300)
Int iIndent;
# endif
# if (_WIN32_WINNT & gt;=0 x0501)
Int iGroupId;
UINT cColumns;//tile view columns
_int64 puColumns;
# endif
# if _WIN32_WINNT & gt;=0 x0600
_int64 piColFmt;
Int iGroup;//readonly. Only valid for the owner data.
# endif
} LVITEM64;


Void main () {
The HWND hDestTop;
HDestTop=: : FindWindow (L "progman", NULL);
HDestTop=: : FindWindowEx (hDestTop, 0, L "shelldll_defview", NULL);
HDestTop=: : FindWindowEx (hDestTop, 0, L "syslistview32", NULL);

Int count=(int) : : SendMessage (hDestTop LVM_GETITEMCOUNT, 0, 0);

LVITEM64 lvi, * _lvi;
Would the item [512], the subitem [512].
_item would * and * _subitem;
Unsigned long pid;
HANDLE the process.

GetWindowThreadProcessId (hDestTop, & amp; Pid);
The process=OpenProcess (PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_QUERY_INFORMATION, FALSE, pid);

_lvi=(LVITEM64 *) VirtualAllocEx (process, NULL, sizeof (LVITEM64), MEM_COMMIT, PAGE_READWRITE);
_item=(would be *) VirtualAllocEx (process, NULL, 512 * sizeof (would be), MEM_COMMIT, PAGE_READWRITE);
_subitem=(would be *) VirtualAllocEx (process, NULL, 512 * sizeof (would be), MEM_COMMIT, PAGE_READWRITE);

The RECT rc;
Rc. Left=LVIR_ICON;//this must set can go to the MSDN about LVM_GETITEMRECT description
The RECT * _rc=(*) the RECT VirtualAllocEx (process, NULL, sizeof (the RECT), MEM_COMMIT, PAGE_READWRITE);

Lvi. CchTextMax=512;

For (int I=0; i
Lvi. ISubItem=0;
Lvi. PszText=(_int64 _item);
WriteProcessMemory (process, _lvi, & amp; Lvi, sizeof (LVITEM64), NULL);
: : SendMessage (hDestTop LVM_GETITEMTEXT, (WPARAM), I (LPARAM) _lvi);

Lvi. ISubItem=1;
Lvi. PszText=(_int64 _subitem);
WriteProcessMemory (process, _lvi, & amp; Lvi, sizeof (LVITEM64), NULL);
: : SendMessage (hDestTop LVM_GETITEMTEXT, (WPARAM), I (LPARAM) _lvi);

: : WriteProcessMemory (process, _rc, & amp; Rc, sizeof (rc), NULL);
: : SendMessage (hDestTop LVM_GETITEMRECT, (WPARAM), I (LPARAM) _rc);

ReadProcessMemory (process, _item, item, 512 * sizeof (would be), NULL);
ReadProcessMemory (process, _subitem subitem, 512 * sizeof (would be), NULL);


ReadProcessMemory (process, _rc, & amp; Rc, sizeof (rc), NULL);
_cwprintf (L "TP LF % s to % s: % d: % d RT: BT: % d % d \ n", the item, the subitem, rc, left, rc, top, rc. Right, rc, bottom);

}

VirtualFreeEx (process, _lvi, 0, MEM_RELEASE);
VirtualFreeEx (process, _item, 0, MEM_RELEASE);
VirtualFreeEx (process, _subitem, 0, MEM_RELEASE);
VirtualFreeEx (process, _rc, 0, MEM_RELEASE);

The CloseHandle (process);

}


The original https://blog.csdn.net/jackflit/article/details/50198955
Mainly is to want to use vb to realize the desktop icon to get and put. Xp can. Under Windows 7 64.
The great god can implement can pay

CodePudding user response:

Only 100 points. Do not leave your contact way to pay. Thank you for the great god.

CodePudding user response:

Pay for budget?

Should be ok, but a little trouble...
First to determine the median of the operating system is 64 bit or 32 bit, and then fill the information according to the corresponding data structure,

CodePudding user response:

If the icon is known, can need not so trouble, you just need to two steps to solve the problem,
Screenshots, contrast color coordinate value,
Of course, is not rigorous, but also can solve the problem,

CodePudding user response:

http://blog.sina.com.cn/s/blog_7a44d6090101a5o3.html

CodePudding user response:

Code looks like plugins fierce in the operating memory ,
In fact this way of SDK code VB root can be literal translation, it also requires people ?
And ah, now that you have C source code, why don't you directly using VC to build a dynamic library project to VB to compile a API calls, such effect is high is not easy to get wrong, VB, after all, do not work directly on the Win32 subsystem, some things are convenient to use C,

CodePudding user response:

Seem to be very advanced, see more dazzling, build the building Lord to give up, or click here
  •  Tags:  
  • API
  • Related