|
Ensure that the dialog style contains WS_SYSMENU flag.
Also, make sure that virtual DestroyWindow function is not overriden in your class with not functional code.
Regards
|
|
|
|
|
My program is SDI application. In order to support multi-language interface,all text of menus , tooltips of tool buttons and text displayed in dialogs are wrote in a text file.when mouse move over the tool buttons and the menus ,the tooltips will display on the status button.
I want change tooltip text on the statusbar when mouse move over diffrent tool buttons in the toolbar ,or move over diffrent menus ,and the tooltip text is from the text file .the tooltip text is not from string table in Resouce .
how can i do in my application?
Could you help me ?
Any help will definitely be appreciated.
|
|
|
|
|
In MFC, see the CToolTipCtrl class.
In CWnd, check out these functions: EnableToolTips, CancelToolTips, FilterToolTipMessage, and
OnToolHitTest.
Mark
|
|
|
|
|
hello,
i write a service and it can run well,but i have found a problem,that is if the service is running i can uninstall it successfully(stop it ,delete the record in the service list and registry),but if the service is already stoppped,then i can not delete the service(the record is still in the service list and the registry),and the service labeld disabled and the service can not be installed again after reboot the machine,what is the matter?what can i do to solve this problem?
|
|
|
|
|
|
Hi,
You should post a bit of code, responsible for the process of service uninstall.
Regards
|
|
|
|
|
the code is below,all code i found to uninstall service like this:
void CService::UnInstallService(TCHAR *tcServiceName)
{
SC_HANDLE schService;
SC_HANDLE schSCManager;
if(lstrlen(tcServiceName)<=0)
return;
schSCManager = OpenSCManager(
NULL, // machine (NULL == local)
NULL, // database (NULL == default)
SC_MANAGER_ALL_ACCESS // access required
);
if ( schSCManager )
{
schService = OpenService(schSCManager, tcServiceName, SERVICE_ALL_ACCESS);
if (schService)
{
// try to stop the service
if ( ControlService( schService, SERVICE_CONTROL_STOP, &serviceStatus ) )
{
_tprintf(TEXT("Stopping %s."), tcServiceName);
Sleep( 1000 );
while( QueryServiceStatus( schService, &serviceStatus ) )
{
if ( serviceStatus.dwCurrentState == SERVICE_STOP_PENDING )
{
_tprintf(TEXT("."));
Sleep( 1000 );
}
else
break;
}
if ( serviceStatus.dwCurrentState == SERVICE_STOPPED )
_tprintf(TEXT("\n%s stopped.\n"), tcServiceName );
else
_tprintf(TEXT("\n%s failed to stop.\n"), tcServiceName );
}
// now remove the service
if( DeleteService(schService) )
_tprintf(TEXT("%s removed.\n"), tcServiceName );
else
_tprintf(TEXT("DeleteService failed - %s\n"), GetLastErrorText(szErr,256));
CloseServiceHandle(schService);
}
else
_tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256));
CloseServiceHandle(schSCManager);
}
else
_tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256));
}
someone can help me or give me the reason?
|
|
|
|
|
Make sure that SERVICE_STOP_PENDING is reported by service in ServiceCtrl callback function for SERVICE_CONTROL_STOP code as well as proper timeout for service stop completion.
Regards
|
|
|
|
|
everybody can download some sample code from here,and tried,almost have the problem.
|
|
|
|
|
from where?
|
|
|
|
|
you can download a sample service from the link:
http://www.codeproject.com/system/cntservice.asp
|
|
|
|
|
Hello All
Actually i found an article on codeproject for exporting messages from outlook in text form now i want that messages should be .msg type .I simply changed this function given in the code too
const char* typetoext(long type)
{
if(type == 0){//message (email)
return ".txt";
}else if(type == 1){//calendar
return ".ics";
}else if(type == 2){//contact
return ".vcf";
}else if(type == 3){//task
return ".ics";
}else{
return 0;
}
}
const char* typetoext(long type)
{
if(type == 0){//message (email)
return ".msg";
}else if(type == 1){//calendar
return ".ics";
}else if(type == 2){//contact
return ".vcf";
}else if(type == 3){//task
return ".ics";
}else{
return 0;
}
}
Its giving the file
but when i click to open the file it gives an error "cannot open this file"
Can anybody help me in doing this
|
|
|
|
|
Changing the extension of the file won't adapt magically the contents of the file to the file format you are looking for. You need to follow the format which is required by the .msg file. You can have a look here[^], see if it helps.
|
|
|
|
|
I'd like to do "on the fly" compression during a recording from sound card.
I know how to record into PCM .wav file. I don't want to use codecs
to compress but LAME or oggenc external programs.
But still I can not figure out how to pass in data, I just got from sound card buffer, into for example LAME.
..somehow from stdin ?
I can not use lame dll, i need it more flexible.
Does anyone know some example?
Thank you
viliam
|
|
|
|
|
Hello everyone:
I want to send a dummy mouse click message to desktop from a application. Please help me how to do, Thank you .
-Freehawk
|
|
|
|
|
If I understood your question clearly; is this what you want ?
::SendMessage(GetDesktopWindow(),WM_RBUTTONDOWN,wParam,lParam);
|
|
|
|
|
Hi,
Use SendInput or mouse_event function to emulate mouse actions.
Regards
|
|
|
|
|
I have started using VS 2005 for my MFC C++ applications, however I get loads of warnings, mainly the use of strcpy.
Are they a simple guide for moving up to VS 2005, I am having problems with strcpy etc.
I get in a mess if I just change to strcpy_s.
Also keep getting told to use new options to suppress these warnings, but they dont seem to make any difference.
Any suggestions please.
|
|
|
|
|
|
Andy202 wrote: ...however I get loads of warnings, mainly the use of strcpy.
Because it's unsafe. Use strcpy_s() instead.
Andy202 wrote: I get in a mess if I just change to strcpy_s.
Why? Can you work around it with a #define directive?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks for your post. strcpy works in some places but not others.
If I use it here in this module I get an error:
strcpy_s(pchData, LPCSTR(signalName));<br />
<br />
1>c:\mcs_am_emu\am_emu\am_e\signaldlg.cpp(1135) : error C2660: 'strcpy_s' : function does not take 2 arguments
This confuses me!?!
Andy.
|
|
|
|
|
That's because you have to specify length of the destination buffer. It's all about securing from buffer underruns.
strcpy_s(pchData, put_length_of_pchData_here, LPCSTR(signalName));
Regards
|
|
|
|
|
frontpage has a option to open a web thru file-open web command.
it displays a tree view control. i wanted to read the text of the root node in the control. so i tried the following:
1) HTREEITEM htitem;
htitem=TreeView_GetRoot(hWnd); //hWnd is the handle to the tree control
2) char Buf[80];
TVITEM tvitem;
tvitem.mask=TVIF_TEXT | TVIF_HANDLE;
tvitem.hItem=htitem;
tvitem.pszText=(LPSTR)&Buf;
tvitem.cchTextMax=79;
3) SendMessage(hWnd, TVM_GETITEM, 0, (LPARAM)&tvitem);
but this fails. why?
following works:
1) int cnt=SendMessage(hWnd, TVM_GETCOUNT, 0, 0);
2) SendMessage(hWnd, TVM_SELECTITEM, TVGN_CARET, htitem);
if this works, why tvm_getitem fails?
can anyone help?
thanks
|
|
|
|
|
Just a guess, but I suspect that Buf needs to be on the heap.
char *pBuf = new char[80];
tvitem.pszText = pBuf;
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all
I had been doing dialog based work till now (MFC). Now that I would like to learn SDI and MDI, I will be glad if you can provide me with links to articles regarding the same for beginners. Thanks for your time.
|
|
|
|