|
Please help a novice...
You know how in Windows Explorer you can right click a file, select Properties, and the dialog appears? I need files of a particular extension to execute MY DLL in lieu of the Windows File Properties actions. Does anyone know how to do this? I'd appreciate any help.
Thanks.
|
|
|
|
|
The Properties menu item is part of the OS (it connects to some OS functions that tell you stuff like the date the file was created, last modified, MSDOS name, etc). You can edit the registry to add addition items to the menu (ie "Settings" in addition to the "Properties" menu item). To do this, you can edit the registry by hand or copy the following script (replacing with your apps names and extensions
; Script starts here
REGEDIT
HKEY_CLASSES_ROOT\.ext = My.Document
HKEY_CLASSES_ROOT\My.Document = My Document
HKEY_CLASSES_ROOT\My.Document\shell\mycommand = &My Command
HKEY_CLASSES_ROOT\My.Document\shell\mycommand\command = "C:\thing\to\execute" "arguments"
; End script
Replace . . .
.ext with your extension
My.Document with your Document type (must match with the Document type your application wants)
My Document with you Document name (can be anything you want to appear in Windows Properties
mycommand with the name of the command you want (ie Settings)
&My Command with the string you want to appear in the drop down menu (the & will underline the following character so if you right click and press M, for this example, it would run My Command)
"C:\thing\to\execute" with the path to your program or dll (you may need a surrogate for a dll)
"arguments" with any arguments your application needs (ie filename)
Hope this helps
Zac
|
|
|
|
|
Thanks for your help
This requirement is always changing...
|
|
|
|
|
Is there any way to get Grand Child of a process
|
|
|
|
|
On Win9X and 2000 (not NT4) you can use TOOLHELP api. You call CreateToolhelp32Snapshot, then iterate over the snapshot using Process32First/Process32Next. Process32xxx functions fill PROCESSENTRY32 structure, and one of the members is th32ParentProcessID - check it to determine the parent-child relationships.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I need to test a program that sends and receives data over a serial port. It will eventually connect to some specific hardware, but for the moment I need a program that will emulate the responses the hardware would give. So here's my problem. . .
Program 1 will send and get data on the serial port.
Program 2 will respond over the serial port to Program 1.
Program Proxy will redirect the communication from the actual serial port to the programs (ie Program 1 sends data, the proxy redirects it from the serial port to Program 2).
Program 1 and 2 are easy (they will just use standard Serial communication protocol). However, the Proxy is where I am getting caught. Does anyone know how I can get information being written to the serial port and redirect it to another program on the same machine?
Thanks
Zac
|
|
|
|
|
I think you could either:
1) Get another serial port and wire it up to your existing one in a loopback.
2) Use named pipes for the comms while you are testing instead of serial port.
Either way there is no need for the proxy program.
|
|
|
|
|
I use spawncl(...) to run other applications.
I then get the hWnd of the new application.
(i use a hook to see when a wnd is created/activated/destroyed)
The fuction ::GetWindowText(...) works fine and i get the windows title.
But when i call ::GetWindowModuleFilename(...) i get the filename of
my application, not the new one.
If i run Task manager, i can see the filename of the new application!
What can i do? Is there another way to get the filename instead
of ::GetWindowModuleFilename(...) , or i souldn't use spawn(...)
and use CreateProcess(...) or RunWin(...) ?
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
What exactly is the problem? You are passing the executable filename to the spawn/CreateProcess/WinExec. Why do you want to retrieve it using hwnd? Do you think Windows is replacing your exe with something else?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
How can i disagree.
You are right!
I didn't describe it correctly.
My application sets a system hook to
get notified for all created windows.
That's why i want to get the filename
from the hWnd. It's not limited to the
programs that i run with spawn*(...).
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
How can i disagree.
You are right!
I didn't describe it correctly.
My application sets a system hook to
get notified for all created windows.
That's why i want to get the filename
from the hWnd. It's not limited to the
programs that i run with spawn*(...).
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
This doesn't work on NT or Win2K!
See http://msdn.microsoft.com/library/psdk/winbase/psapi_9cc3.htm
Mh2x
|
|
|
|
|
I quess i have to do the following:
DWORD ProcessID;
GetWindowThreadProcessId(hWnd,&dwProcessID);
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION| PROCESS_VM_READ,FALSE, processID );
HMODULE hMod;
DWORD cbNeeded;
EnumProcessModules( hProcess, &hMod, sizeof(hMod),&cbNeeded);
GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName) );
CloseHandle( hProcess );
i will try it tonight.
Thanks.
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
Is there an easy way to create a dialog app that when executed doesn't appear but is still running in the background?
Thanks in advance!!
Rob Jones
|
|
|
|
|
Do you expect your dialog to be always invisible? Or only until some event occurs?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
|
If your app targets NT/W2K only, you can consider creating a service. If you need to run on Win9x, hiding main window should work.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I Use ShowWindow(SW_HIDE)
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
I *finally* figured out how to use the CTime class successfully...
CTime CurrentTime = CTime::GetCurrentTime();
or
CTime CurrentTime;
//blah blah
CurrentTime = CTime::GetCurrentTime();
I don't get it. Why do you have to do it that way, and why doesn't the following work...
CTime CurrentTime;
CurrentTime.GetCurrentTime();
- John
------------------------------------------------
Before you critisize a man, walk a mile in his shoes. Then when you critisize him, you are a mile away and have his shoes.
|
|
|
|
|
CTime tm = CTime::GetCurrentTime();
If you want to Know the Hour or the minutes, you can do:
CTime tm = CTime::GetCurrentTime();
int nHour = tm.GetHour();
int nMin = tm.GetMinute();
etc.
Regards...
Carlos Antollini.
|
|
|
|
|
I think my question was unclear. I don't understand why the CTime object has to be initialized that way. Why can't it be initialized like this:
CTime tm;
tm.GetCurrentTime();
- John
|
|
|
|
|
Because the definition of GetCurrentTime is
CTime GetCurrentTime(); And not void CTime::GetCurrentTime();
I think that this is a cuestion for the Microsoft Developers.....
Is True, Is more is more intuitive of the other form, but they developed it of that
way.
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
I'm not sure of the exact implementation details, but did you notice that the GetCurrentTime method of the CTime class is a 'static' method? That is the reason for how it is used. Why it's declaration is such, I don't know. That relates to how the developers decided to do things.
Chris
|
|
|
|
|
Yeah GetCurrentTime is a static method that is why you call it using that syntax. The method create a CTime object in this way CTime(::time(NULL)). The GetCurrentTime is creating a new CTime Object of which the member m_time contains the latest time.The assignment operator copies this value
CTime tm;
tm=CTime::GetCurrentTime();// operator=(const CTime& timeSrc) comes into action
Mail back if you have more info
|
|
|
|
|
Yeah GetCurrentTime is a static method that is why you call it using that syntax. The method create a CTime object in this way CTime(::time(NULL)). The GetCurrentTime is creating a new CTime Object of which the member m_time contains the latest time.The assignment operator copies this value
CTime tm;
tm=CTime::GetCurrentTime();// operator=(const CTime& timeSrc) comes into action
Mail back if you have more info
|
|
|
|