|
I once did that using COM connection points, it was hard but very fast. A Windows Sockets loopback would probably have been easier, any form of IPC (InterProcess Communication) would do the trick but stay away from DDE (Devilish Data Exchange). Some people get on with memory mapped files and other don't. Rumours of COM runtime shared memory implementations persist despite the horror of such a thing and there are all sorts of off the shelf bits of middle ware and messaging frameworks gathering dust and waiting for someone to turn them into applications.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
have a look at ControlService() API and make of user-defined control code.
if not suitable, i think IPC is the option as mathew already said.
|
|
|
|
|
Rajkumar R wrote: have a look at ControlService() API and make of user-defined control code.
It looks like that ControlService can only send code but can not take additional data with the code?! (Something like wParam and lParam stuff)
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: It looks like that ControlService can only send code
yes.
Maxwell Chen wrote: but can not take additional data with the code?! (Something like wParam and lParam stuff)
he doesnot want to pass the Window message as it
nitin3 wrote: When the window receive a message i need to pass some information regarding message ( a structure ) to the service.
he want to pass some info regarding the message.
if he can do it as unique code, much of work to implement IPC is avoided. otherwise IPC, that already i meantioned in my reply.
|
|
|
|
|
Third time I am posting the same question but nobody answrered it. Is this tricky question or anything else.
I have written a ContextMenuHandler in VC++, creating a Right-Click for all files (*) and all works really well except that it does not handle .lnk files.
With .lnk files I can only get the target file (eg an exe file) .
Can anyone tell me how to get the .lnk file path?
My code to retrieve the file name is as follows:
<br />
void CCoMenHandler::GetSelectedFiles(LPCITEMIDLIST pidlFolder,IDataObject *pdtobj)<br />
<br />
{<br />
<br />
g_szSelectedFiles.RemoveAll();<br />
<br />
if (pdtobj) <br />
{<br />
pdtobj->AddRef();<br />
<br />
STGMEDIUM medium;<br />
FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};<br />
<br />
HRESULT hr = pdtobj->GetData (&fe, &medium);<br />
if (FAILED (hr))<br />
{<br />
g_bRecyleBin=TRUE;<br />
GetRecycleBinFiles();
return ;<br />
}<br />
g_bRecyleBin=FALSE;<br />
char path[MAX_PATH];<br />
<br />
UINT fileCount = DragQueryFile((HDROP)medium.hGlobal, 0xFFFFFFFF,<br />
path, MAX_PATH);<br />
<br />
if (fileCount>0)<br />
{<br />
g_szSelectedFiles.SetSize(fileCount);<br />
<br />
for (UINT i=0;i<fileCount;i++) <br />
{<br />
memset(path, 0, MAX_PATH);<br />
if (DragQueryFile((HDROP)medium.lpszFileName, i, path, MAX_PATH)) <br />
{<br />
g_szSelectedFiles.SetAt(i, path);<br />
}<br />
}<br />
<br />
g_szSelectedFiles.FreeExtra();<br />
}<br />
<br />
ReleaseStgMedium(&medium);<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
modified on Friday, February 22, 2008 6:44 AM
|
|
|
|
|
My first instinct is to ignore reposts...
But it's a harder question than it sounds.
But when I read your first post, I did a bit of research - and I hate to waste work I already did.
I read through Michael Dunn's shell extension articles (my go to reference for all this stuff). When an extension is initially used, the IShellExiInit interface of your COM object is retrieved, and its Initialize method called.
This gives the PIDL of the directory, and a IDataObject interface to interrogate.
If you call the pDataObject->GetData with the HDROP formatetc parameter, you get the destination of the link.
BUT:
I then called the EnumFormatEtc, and logged the results.
At the bottom is my code, and here are the results:
Clipboard format name: Shell IDList Array
Clipboard format code: 15
Clipboard format name: FileName
Clipboard format name: FileNameW
15 corresponds to CF_HDROP - but there are other formats you can grab the data in.
I think these other formats are worthy of your investigation - especially Shell IDList Array. I've just done a google search, and there are many good soundign hits, even a few from codeproject.
I'd be interested in your results!
Good luck,
Iain.
STDMETHODIMP CSimpleShlExt::Initialize ( LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hProgID )
{
FORMATETC f, fmt = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM stg = { TYMED_HGLOBAL };
HDROP hDrop;
HRESULT hr = S_OK;
TCHAR oBuf [MAX_PATH];
IEnumFORMATETC *pEnum = NULL;
hr = pDataObj->EnumFormatEtc (DATADIR_GET, &pEnum);
if (SUCCEEDED(hr))
{
TCHAR szBuf [1025] = { 0 };
ULONG lFetched = 0;
while (S_OK == pEnum->Next (1, &f, &lFetched))
{
if (GetClipboardFormatName (f.cfFormat, szBuf, 1024))
wsprintf (oBuf, _T("Clipboard format name: %s\n"), szBuf);
else
wsprintf (oBuf, _T("Clipboard format code: %i\n"), f.cfFormat);
OutputDebugString (oBuf);
}
pEnum->Release ();
}
.....
etc
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
I have a 'Table' object (reads a text file to create a table and return table picks). I have moved the code into it's own class library project, and I wish to call the code in the .dll from the main app. The class library project compiles to a .dll, but I don't know how to add it to the main project. I have addded the header file to the main project, and put the .dll in the source directory and debug directories.
How do I add a reference to the .dll? Do I use '#include' or '#using'? How do I declare / instantiate the object, etc. (my attempts broke the build).
What are the basic steps to do this? Can I put both projects in the same solution? Both are in C++ / VS2005. THe main app is from the DirectX SDK April 2007.
Thanks,
Steve
|
|
|
|
|
|
|
I have read the article 'DLLs are simple: Part 2' and have successfully moved the code for my Table class into it's own project / .dll.
The example was for VC++ 6.0, whereas my application is in VS 2005. The main difference was the 'Project > Settings > Link (tab)' -- this doesn't exist in VS2005. To add the .lib file to the project, I put it in the main project directory and right-clicked on the solution and added an existing item, for file type I had to select 'all file types *.*', and added the .lib file to the project. I put the .dll in the debug folder, where the .exe gets put after a build.
What I haven't done yet is to add my .dll project to the main project. I plan to add a new class library to the main application project, and copy and paste the code from the .dll project into it, and hope that it creates a .dll file, a .lib file, and a .exe file. The hope is that I would then be able to take the .dll, .lib, and .h file and use it in other projects.
The purpose of this was to create a fast distance function, which does not call the sqrt function. It takes two or three parameters and returns length of the 'hypotenuse' without using sqrt. With a lookup table of only three points, I get an accuracy of within 1.5%, more than good enough for my level of detail calculations. It will be interesting to see if my function is actually faster or not.
Steve
|
|
|
|
|
TheGeneral69 wrote: The main difference was the 'Project > Settings > Link (tab)' -- this doesn't exist in VS2005. To add the .lib file to the project, I put it in the main project directory and added the .lib file to the project
projectproperty->linker->input->Additional Dependencies = <libname>
projectproperty->linker->General->Additional Library Directories = <path to libfile>
TheGeneral69 wrote: What I haven't done yet is to add my .dll project to the main project.
TheGeneral69 wrote: copy and paste the code from the .dll project into it, and hope that it creates a .dll file, a .lib file, and a .exe file
just add your dll project to your main project solution.
TheGeneral69 wrote: The hope is that I would then be able to take the .dll, .lib, and .h file and use it in other projects.
yes. you can.
|
|
|
|
|
ahh, I saw that linker dialogue, but didn't know how to set it up.
thanks again!
|
|
|
|
|
Hi friends.
i have some queries about ...constructor and destructor
Why to we need these two?and whats the difference between these two.
plz explain some small examples....
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
Object lifetime[^]
may be useful
modified to not to refer little OOP Book Friday, February 22, 2008 8:52 AM
And go for some big OOP book, otherwise u learn only little (initialisation & cleanup).
|
|
|
|
|
Initialization and Cleanup.
BTW What about a little OOP book?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: BTW What about a little OOP book?
Not bad.
|
|
|
|
|
rowdy_vc++ wrote: Why to we need these two?
Actually, I believe one is required while the other is optional. It's implementation-dependent, of course.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The compile error message I get is this:
compiling...
MyVariable01Dlg.cpp
c:\MFC_Todays_Work\Tree_Prop_Sheet_Project_20Feb08_pm\MyVariable01Dlg.h(15) : error C2065: 'IDD_PROPPAGE_MyVariable01' : undeclared identifier
Build log was saved at "file://c:\MFC_Todays_Work\Tree_Prop_Sheet_Project_20Feb08_pm\Debug\BuildLog.htm"
TreePropSheet - 1 error(s), 0 warning(s)
Yet, I have defined IDD_PROPPAGE_MyVariable01 in my code as shown and the name in the property sheet is OK
<red>enum { IDD = IDD_PROPPAGE_MyVariable01 };</red>
I am running Visual Studio.net version 2003 on a current Win XP workstation
I'm new at this, so it is probably something very simple. The problem occured when I added a fourth sheet to a module that contained three sheets and worked OK.
Any help much appreciated.
Response 26 Feb 08
Thanks for your feedback. I hadn't thought of a failure brought about by not recompiling the PCH file, which I did and no luck.
I agree the variable was not defined, so I restarted from scratch and second time round worked OK.
I'm learning that MFC can be a handful.
modified on Tuesday, February 26, 2008 12:23 AM
|
|
|
|
|
doorprize wrote: Yet, I have defined IDD_PROPPAGE_MyVariable01 in my code as shown and the name in the property sheet is OK
enum { IDD = IDD_PROPPAGE_MyVariable01 };
here u defined IDD and initialized to IDD_PROPPAGE_MyVariable01 which is undeclared.
may be u changed the ID of the property page to some new value or the resource.h is not including in the compilation path of MyVariable01Dlg.cpp.
|
|
|
|
|
doorprize wrote: Yet, I have defined IDD_PROPPAGE_MyVariable01 in my code as shown and the name in the property sheet is OK
enum { IDD = IDD_PROPPAGE_MyVariable01 };
No, you've neither declared nor defined IDD_PROPPAGE_MyVariable01 , only referenced it.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
is it possible to have a standalone system tray icon without an exe ?
Typically an exe exposes a System tray icon .
However my requirement is such that I would want to launch an app after the user selects an element from the system tray. Is this feasible ?
For some of the icons (such as the LAN/Network status ) , I do not see a corresponding application in the taskbar. How are these implemented ?
Engineering is the effort !
|
|
|
|
|
act_x wrote: is it possible to have a standalone system tray icon without an exe ?
Typically an exe exposes a System tray icon .
No. If you wanted to do something like this you should make a small launcher application which manages the tray icon and launches the main application when needed.
Steve
|
|
|
|
|
There is quite a large amount of data that can be stored in an exe under the Version Info resource. Can I retrieve that data( if so how) at a later stage, even if the file is running.
Regards,
Bram van Kampen
|
|
|
|
|
See the GetFileVersionInfo[^] function and friends. You may also want to search this site for this function to find some examples.
Steve
|
|
|
|
|
Bram van Kampen wrote: Can I retrieve that data( if so how) at a later stage, even if the file is running.
Like this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|