|
i am very interested in the method of "Not necessarily", any comment about it?
cheers
includeh10
|
|
|
|
|
It requires just a few more entries in the .reg file:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.mytype]
@="MyType.Document"
[HKEY_CLASSES_ROOT\MyType.Document]
[HKEY_CLASSES_ROOT\MyType.Document\shell]
[HKEY_CLASSES_ROOT\MyType.Document\shell\Calc]
[HKEY_CLASSES_ROOT\MyType.Document\shell\Calc\command]
@="c:\\winnt\\system32\\calc.exe" As has already been mentioned, this sort of stuff is explained in Michael Dunn's shell articles.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
you are talking about how to use double-clicking of a kind of file.
i modified register as your comment, but i saw nothing on popup menu of Explorer.
when i double clicked some.mytype, calculator was running.
it is not right answer of my question.
i read Michael Dunn's articles again, i can not find hint about my question.
he added a program to menu folder "send to" of popup menu of Explorer by
::SHGetSpecialFolderLocation(0,CSIDL_SENDTO,&pidl)
i will try to get answer from that point.
cheers
includeh10
|
|
|
|
|
includeh10 wrote:
when i double clicked some.mytype, calculator was running.
When you right-clicked an item that had a .mytype extension, you should have seen Calc at the top of the context menu. The fact that it was bold meant that it was the default option. That's why double-clicking the item started the calculator.
My example was merely that - an example. You may need to extrapolate from the examples to get what you want. Not all shell items are the same so there is no one-size-fits-all solution.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
DavidCrow,
i think maybe something is wrong with my test.
@=mytype.document
what does it exactly mean under key of .mytype?
if we open regedit, it looks
name ------------ data
default --------- @=mytype.document
or
@ --------------- mytype.document
or
other format??
cheers
includeh10
|
|
|
|
|
Hi!
I was wondering if anyone would be so kind to show me some complete sample code on how to use a MSAgent in Visual C++ .NET. I am having some trouble figuring it out also because of my limited C++ knowledge
Thanx
Nina
|
|
|
|
|
|
I need some help for comparing images, to determinning if
the shapes on one image is equal anthor image
On Earth nothing impossible,
while your mind running.
Faroqtam
|
|
|
|
|
Check out my C# articles for algorithms for edge detection. Once you detect the edges, then you can compare them. That's not to say the rest is easy, but if you can detect outlines, then you can attempt to map them, and see how similar they are.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi Christian
Thanx thanx thanx thanx alot
On Earth nothing impossible,
while your mind running.
Faroqtam
|
|
|
|
|
hi!
i'm creating a media playing.. using MCI .... the app dosen't play files from multiple directories... though they are added to the listbox.. they are not played .
The problem is that i want to load files from multiple directories and it plays files only from one directory... i.e the one from which the files were last loaded from. the files that were loaded from other directories do not play - V.G
|
|
|
|
|
What do you mean by "do not play?" Do you receive some sort of error message? Since paths are involved, are you confusing absolute with relative paths?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
#include <iostream.h>
class B {
public :
int datab;
virtual void AccessB() { };
protected :
int datac;
};
class D :virtual public B {
public :
void AccessB()
{
datab=1;
cout<<"Data is"<<datab<<endl;
datab="10;
" cout<<"data="" is="" "<<datab<<endl;
="" datac="1;
" }
};
class="" a="" :="" virtual="" public="" b="" {
="" :
="" void="" accessb()
="" cout<<endl<<"="" i="" am="" "<<endl;
="" }
};
class="" e="" d="" ,=""
{
public="" :
=""
="" accessd()
="" }
};
void="" main()
{
="" bobj;
="" *bptr="" ;="" dobj;
="" bptr="&dobj;
" bptr-="">AccessB();
}
This doesnt compile as AccessB is unresolved in E . I dont want an implementation of AccessB in E , What needs to be changed ?
|
|
|
|
|
|
Hi,
I'm having a problem passing command line arguments in VS 2003 without opening a command prompt. The link below shows a picture of my debugging properties dialog box. My command arguments are set as shown in the picture. When I run the program in debug mode from the IDE, argc is always equal to 1, regardless of the content of the command arguments edit box. I don't have this problem when I do the same procedure from the command prompt.
What am I missing?
http://groups.msn.com/_Secure/0TQAAAPAYi*BNCm8Mz8eUuz9tIVTfLstvPYH5Adg69*I2R2hO*fV9qTZlCyf!0iXvfbGRM2ifmlrvxywZWPQSzq7KKzeWUNC3hqCjMo01zvIlivF!okCEdw/problem.jpg
Cheers, blackmesa.
|
|
|
|
|
Hi guys,
I'm writing a program that should monitor the "active" application's copying and pasting.I decided on using use a system-wide WH_CBTPROC hook and a thread-specific WH_CALLWNDPROC hook to capture the WM_PASTE and WM_COPY messages.
The hooking works OK, the problem is that the WH_CALLWNDPROC causes the menus in "Microsoft Word" not to display. Am i using the hook wrong? (Maybe not passing the messages along). And it makes the programs realllllyy slowww. I'm running a Duron 800mhz, should it have such a big influence on performance?
Any Ideas? Thanks
The base code looks like this.
<br />
HINSTANCE hins;<br />
HHOOK hmsg = NULL;<br />
HHOOK hcbt = NULL;<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{ <br />
hins=(HINSTANCE)hModule;<br />
<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
return TRUE;<br />
}<br />
LRESULT CALLBACK MsgProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
char *file = new char[100];<br />
file = "c:\\test.txt";<br />
fstream out(file,ios::out | ios::app);<br />
<br />
<br />
if (nCode < 0)<br />
{<br />
LRESULT RetVal = CallNextHookEx( hmsg, nCode, wParam, lParam ); <br />
return RetVal;<br />
}<br />
<br />
<br />
if (HC_ACTION==nCode) <br />
{<br />
CWPSTRUCT *msgInfo = (CWPSTRUCT*)lParam;<br />
switch (msgInfo->message)<br />
{<br />
case WM_COPY: <br />
out << "COPY" << endl;<br />
break;<br />
<br />
case WM_PASTE:<br />
out << "PASTE" << endl;<br />
break;<br />
}<br />
}<br />
<br />
LRESULT RetVal = CallNextHookEx( hmsg, nCode, wParam, lParam ); <br />
return RetVal;<br />
}<br />
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
char *file = new char[100];<br />
file = "c:\\test.txt";<br />
fstream out(file,ios::out | ios::app);<br />
<br />
<br />
DWORD ProcessId;<br />
char szModName[MAX_PATH];<br />
HWND current_window;<br />
<br />
HANDLE hProcess;<br />
SYSTEMTIME SystemTime;<br />
<br />
if (nCode == HCBT_ACTIVATE)<br />
{ <br />
<br />
current_window = (HWND)wParam;<br />
<br />
GetWindowThreadProcessId( current_window,&ProcessId);<br />
<br />
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |<br />
PROCESS_VM_READ,<br />
FALSE, ProcessId );<br />
<br />
int length = GetModuleFileNameEx( hProcess, NULL, szModName,sizeof(szModName));<br />
<br />
out << szModName << endl;<br />
<br />
if (hmsg == NULL)<br />
{<br />
hmsg = SetWindowsHookEx(WH_CALLWNDPROC,(HOOKPROC)MsgProc,hins,GetWindowThreadProcessId(current_window,0));<br />
}<br />
<br />
}<br />
<br />
<br />
return CallNextHookEx( hcbt, nCode, wParam, lParam ); <br />
}<br />
KEYHOOK_API BOOL installhook()<br />
{<br />
hcbt = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTProc,hins,0);<br />
return TRUE;<br />
}<br />
|
|
|
|
|
1. You are 'new' the data each time the function is called? Where do you ever delete your character buffers?
2. Each time HCBT_ACTIVATE is activated you set a windows hook, where do you release the window hook?
3. You write to the same file from each handler. Are you ensured that none of these will be called from multiple threads at the same time?
4. What CloseHandle? "When you are finished with the handle, be sure to close it using the CloseHandle function."
5. I would probably only set hIns on the DLL_PROCESS_ATTACH call, and not on the others.
|
|
|
|
|
The constant calls to 'new' the character buffers (which you don't delete) and opening files are going to have a big performance hit. Doing that each time it will be very slow.
Mike
|
|
|
|
|
Thanks for the excellent suggestions.
Works great now
|
|
|
|
|
Hi
Can some one show me how to write an Enter character (chr 13) to a file?
HANDLE hAppend;
DWORD dwBytesRead, dwBytesWritten;
char buff[1];
TCHAR* filnavnhtml;
hAppend = CreateFile (filnavnhtml, // Open .txt.
GENERIC_WRITE, // Open for writing
0, // Do not share
NULL, // No security
CREATE_ALWAYS, // Open or create
FILE_ATTRIBUTE_NORMAL, // Normal file
NULL); // No template file
// write an enter character to the file
WriteFile (hAppend, buff, dwBytesRead,
&dwBytesWritten, NULL);
|
|
|
|
|
After calling CreateFile() , you'll need to call SetFilePointer(..., FILE_END) to position the file pointer to the end of the file. After that, the call to WriteFile() will look something like:
BYTE b = 13;
WriteFile(..., &b, 1, ...);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi gunnar66,
Here you go...
// Write a carriage return to the file
DWORD dwBytesWritten = 0;
BYTE obByte = 0x0d;
WriteFile(m_hLogFile, obByte, 1, &dwBytesWritten, NULL))
regards,
Dark Angel
|
|
|
|
|
I'm putting this here because I've posted it in the managed C++ forum a couple of times, and I haven't gotten an answer yet.
I have a very good book (except for this one thing) by Tom Archer,"Extending MFC Applications with the .Net framework" and "Visual C++.Net Bible" by the same author, and also "Visual C++ .Net - Step by Step" by Microsoft.
Is there a way to build a mixed (native + managed) that starts off with a CFormView, and then call a windows form that I've created? There's examples for using a windows form if it's the startup form, but not if it's a second form called from an mfc class. Does ANYBODY know how to do this?
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
BlackDice wrote:
I'm putting this here because I've posted it in the managed C++ forum a couple of times, and I haven't gotten an answer yet.
Probably you won't get it here, too.
Yes, even I am blogging now!
|
|
|
|
|
I have a SDI Visual C++ program. It has 1 child window with the title bar... containing the minimize, maximize, and X for closing the Window. I DO NOT want this title bar to be loaded as part of the window when the program starts up. How can someone tell me how to do this?
Thanks.
Jerry
|
|
|
|
|