|
It looks like the content of your CMINVOKECOMMANDINFO structure is not complete; take a look at the documentation[^] for further details.
It's time for a new signature.
|
|
|
|
|
Hi Richard,
Thanks for reply...
now I have tried below code...
Below code is not showing crash as I have used "link" as lpVerb.
as you said I have provided all Content of CMINVOKECOMMANDINFO structure. "InvokeCommand" is return S_OK
But still Paste Shortcut is not happening on Desktop.
void PasteShortcut()
{
try
{
CoInitialize(NULL);
IShellFolder* psf;
HWND hWnd = GetDesktopWindow();
HRESULT hr;
if (SUCCEEDED(SHGetDesktopFolder(&psf)))
{
IContextMenu* pcm;
if (SUCCEEDED(psf->CreateViewObject(hWnd,IID_IContextMenu,(void**)&pcm)))
{
HMENU hmenu = CreatePopupMenu();
if (hmenu != NULL) {
if (SUCCEEDED(pcm->QueryContextMenu(hmenu, 0,
0 , 0xff,
CMF_NORMAL))) {
CMINVOKECOMMANDINFO cmi;
cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
cmi.fMask = 0;
cmi.hwnd = hWnd;
cmi.lpVerb ="link" ;
cmi.lpParameters = NULL;
cmi.lpDirectory = NULL;
cmi.nShow = SW_NORMAL;
cmi.dwHotKey = 0;
cmi.hIcon = NULL;
hr = pcm->InvokeCommand(&cmi);
if (SUCCEEDED(hr)) {
MessageBox(hWnd, TEXT("Shortcut created"), TEXT("Message"), 0);
}
}
DestroyMenu(hmenu);
}
pcm->Release();
}
psf->Release();
}
CoUninitialize();
}
catch(...)
{
}
}
|
|
|
|
|
Rahul Vaishnav wrote: But still Paste Shortcut is not happening on Desktop.
I don't see anything in the above that looks like a source file or a destination shortcut.
It's time for a new signature.
|
|
|
|
|
If anyone has previously used "TModule" in Borland C++, can you please let me know the equivalent(if any) class in win32 or atlease close to that class in similarity. I am migrating one of my application wrtten in borland C++ to visual C++. Just for your reference: "TModule in Borland C++ forms the basis for the TApplication class, which encapsulates the application's global functions such as startup tasks, message loops, and error handling. The TDll class provides a similar base for developing dynamic link libraries (DLL)."
modified on Thursday, July 15, 2010 4:03 AM
|
|
|
|
|
You would probably have much more answers if you describe which functionality you are looking for (for instance I never worked with Borland so I have no clue what this TModule does).
|
|
|
|
|
Thanks for your reply. I have modified my question including the details of what TModule is.
|
|
|
|
|
Ok, but then you can create an MFC application, and some classes will be created for you, like a C...App class (the "..." being your project name). This class also wraps the message loop. It is probably not the same as the one for Borland but I guess it would be similar.
However, you'll need to choose if you want an SDI, MDI or dialog based application.
If you never worked with Visual Studio, I strongly suggest that you buy a book to get started, it will help you a lot at the beginning.
|
|
|
|
|
|
Hi,
in OnDraw() function i draw one 3d effect rectangle by the following code.
pDC->Draw3dRect(SwtRect2,WHITE,DARKGRAY);
By this code,the rectangle looks like 3d rect.
Like the same way can we do that for Ellipse.
I use Ellipse() fucntion but it draws only a flat elipse.
I want to draw like Radio button,so i want that.
Pls help me.
Anu
|
|
|
|
|
Draw3dRect was introduced in Win3.1 to paint those shadowed rectangles that are the buttons.
Radiobutton look& feel are actually small bitmaps coming form user.dll, hence there is no direct API call.
The trick is to draw two ellipses, the first offset-ed by (2,2) with a pen of size 2 and a grayed color, and the second of regular (1) size, no offset, over the first.
More sophisticated looks can be found drawing three of them, one offset-ed to bottom-right (grayed) and another offset-ed to top-left (lighted) and a third "normal".
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Hi,
Can any one send code to convert Modal dialog to modeless dialog & converting modeless dialog to modal dialog.
Thanks,
Venkat
|
|
|
|
|
Instead of the DoModal function, Call Create(), ShowWindow() function. Remeber, the CDialog object should not be local variable if you are calling Create() function. Other wise, the window will be destroyed when the object goes out of scope.
|
|
|
|
|
It's all described here[^].
It's time for a new signature.
|
|
|
|
|
Hi,
can any one send the code for converting SDI application to MDI application & code to convert MDI application to SDI application.
Thanks,
Venkat
|
|
|
|
|
There is no direct conversion, the applications are constructed differently. Take a look at the MDI documentation[^].
It's time for a new signature.
|
|
|
|
|
Probably the simplest way is to create a new MDI project, and then re-use the document and view classes of the SDI app.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
What would be some good ways to exit a C++ program in a way that captures a trace or dump on the way out? Would that dump be human readable or would it somehow load into the VS system and be viewed that way?
|
|
|
|
|
I'm not sure i understand what you mean but check this[^], maybe it can help.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
In my program I have a main thread and many subordinate threads. I use waitformultipleobjects for communication between them. If the main thread is spending too much time doing something (maybe stuck in a loop) then the subordinate threads back up. When one of the subordinate threads gets backed up it's coded to cause a programmatic exit(). Prior to the exit I want to get a snapshot of what's going on so I get try to figure out what the main thread was doing at that time.
|
|
|
|
|
There is a function MiniDumpWriteDump[^] in the Dbghelp.dll. if you call that function it will create a dump file for you.
Later you can analyze this dump using WinDbg.
|
|
|
|
|
Aside of creating that minidump, if possible you could simply create a debug build, place a breakpoint at that exit call (or whatever location suits you) and run it with a debugger, then when it hits the breakpoint you can look around call stacks, memory and whatnot.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Hey guys, thanks for your feedback. I'll try out these suggestions.
|
|
|
|
|
Hi,
I am newbie to vc++,So kindly bare with me.
Some malicious exe file running in a folder c:\documentsandsetting\alluser\globel\phunk.exe
I have killed the phunk.exe from the process and now i want to delete the file phunk.exe from the folder.
how can i implement GetAllUsersProfileDirectory() APi to delete the file please can anyone put the same code for the above scenario.
|
|
|
|
|
Not an answer to your question, but when you say "kindly bare with me" it sounds like you're asking the reader to get naked with you.
You need to use the spelling "bear" which means the big fuzzy ursine critters as well as carrying something. It's an easy mistake to make - quite a few Americans I know keep saying they support the right to bare arms, which is fairly non-controversial if you use sun-screen.
Cheers,
Ash
|
|
|
|
|
hi i am very sorry for my bad englsih...
|
|
|
|