imagenetics
Programmer
Hi there!
I'd call myself rather a fan of programming, than a programmer, and most of my knowledge concerning C++ is based on C++Builder. During Christmas break I decided to finally try some programming in pure WinAPI.
I wrote a tiny application which sits in the shell notification area an provides a popup menu with all available drives. Divided with separators when drive type changes - I'm that good! Each of these items are added dynamically before popping up a menu and are meant to simply open an exlorer's window with the contents of target drive. Everything through building a menu and adding the drives is done. Opening the corresponding windows? Here my programming stops.
How to define a unique ID for each menu item and process messages sent by this ID (or any other solution)? This cannot be done by reading item's string. Those are not drive letters but their explorer's equivalents read with SHGetFileInfo(...).
In C++Builder this was not a problem at all. I simply saved drive letter string in a hint property and a custom OnClick event (the code below) which passed the hint to ShellExecute(...).
I'd be very grateful for help in doing the same thing in WinAPI. A sample source code would be very appreciated. Thank you.
I'd call myself rather a fan of programming, than a programmer, and most of my knowledge concerning C++ is based on C++Builder. During Christmas break I decided to finally try some programming in pure WinAPI.
I wrote a tiny application which sits in the shell notification area an provides a popup menu with all available drives. Divided with separators when drive type changes - I'm that good! Each of these items are added dynamically before popping up a menu and are meant to simply open an exlorer's window with the contents of target drive. Everything through building a menu and adding the drives is done. Opening the corresponding windows? Here my programming stops.
How to define a unique ID for each menu item and process messages sent by this ID (or any other solution)? This cannot be done by reading item's string. Those are not drive letters but their explorer's equivalents read with SHGetFileInfo(...).
In C++Builder this was not a problem at all. I simply saved drive letter string in a hint property and a custom OnClick event (the code below) which passed the hint to ShellExecute(...).
Code:
void __fastcall TFormMain::MenuItemClick(TObject *Sender)
{
TMenuItem *ClickedItem = dynamic_cast<TMenuItem *>(Sender);
if(ClickedItem)
{
ShellExecute(0, "open", ClickedItem->Hint.c_str(), "", "", SW_SHOWNORMAL);
}
}
I'd be very grateful for help in doing the same thing in WinAPI. A sample source code would be very appreciated. Thank you.