|
Luc Pattyn wrote: I'm not a guessing guy
Well, I will not keep going at your limitations...
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
|
|
|
|
|
|
Exceptions depednds to your program,what's your code?
|
|
|
|
|
Every time I used TextOut (e.g. TextOut(dc,20,20,S,strlen(S)); ) with Borland C++ 4.52 under Windows 95 or Windows 98, the position of the text (in the second & third args) was relative to the window that the calling application was running in. But with Visual C++ under Windows Vista the text is positioned (here, at (20,20)) relative to the whole screen. This is a nuisance. What is happening? How can I position the text relative to my application's window?
modified on Saturday, April 12, 2008 9:01 AM
|
|
|
|
|
I dont know why the phenomenon happens, anyway ClientToScreen [^] function maybe useful.
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
|
|
|
|
|
TextOut() in the context you show is a Windows API - it shouldn't vary between compilers.
It could vary between Windows versions, but that would break a lot of apps.
The problem is your DC. The device context determines where the text goes, based on how the DC
was acquired, its mapping mode, its text alignment settings, etc.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I made the device context using ordinary familiar GetDC(hwnd) .
|
|
|
|
|
Then hwnd must have been NULL.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi!
I know this may looks a little funny! But when I use CDialog::EndDialog to terminate my dialog based app, the main window (dialog) disapears well, but when looking at Task Manager, I found it already running!
Can U help me PLS?
|
|
|
|
|
Hi,
If you have other threads running, the app will wait for them to terminate, unless they
are set to be background threads.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks 4 Ur reply!
I've not made any thread myself;
Is it possible for MFC classes to create threads by themselves? (Specially I used CRecordset frequently in my app!)
Thanks 4 Ur attention!
|
|
|
|
|
Usef Marzbani wrote: Is it possible for MFC classes to create threads by themselves?
I don't know, it could be. If so, it must be documented, and the doc should tell you what
to do about it, say call Close(), Stop() or whatever is appropriate.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
EndDialog() may be the wrong method for shutting down your app.
It depends on how and where you create the main dialog. Is it modal or modeless?
Where in the code do you create it?
CDialog::EndDialog is for modal dialogs. That means your main dialog needs to be created modal.
When control returns from the modal dialog, your app needs to exit. It should be something like this:
BOOL CMyApp::InitInstance()
{
CMyMainDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
} If you return TRUE from InitInstance(), that would cause the behavior you're seeing, since the app
would still be running but the dialog would be gone.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Your My(Perfect & Hero)
Thank you!
|
|
|
|
|
Or you can use of PostQuitMessage.
|
|
|
|
|
hi
i need to write the € sign (currency in europe) to a file.
i have some text in a std::wstring which includes a €-sign. if i put the text in the stream any following letter after the euro sign won't receive the output file.
i tried to solve the problem by replacing the sing with the unicode sequence, but with no positivie result
<br />
<br />
#include "stdafx.h"<br />
#include <fstream><br />
<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
std::wstring s = L"Hello World, i own 20 \u20AC hurray!";<br />
std::wofstream out(L"C:/euro.dat", std::ios::binary);<br />
out<<s.c_str();<br />
return 0;<br />
}<br />
</fstream>
my outfile euro.dat contains for this example "Hello World, i own 20 " anything after is missing.
i figured out that if i use std::string it works(why ever), but i would prefer a soloution that supports std::wstring. anyone has a idea how to make things running with wstring ?
|
|
|
|
|
See here [^].
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
|
|
|
|
|
|
Hi all,
I want to pass a CString parameter through ShellExecute() api to my exe..
I am doing this using this code:-
CString CurrentPath = _T("C:\\test\\test.ini");
ShellExecute(NULL,_T("open"),CurrentPath,NULL,NULL,SW_SHOW);
My problem is i don't know how to access this parameter in my exe.
Can anybody tell me how to do so??
Thanks in advance
|
|
|
|
|
I see no exe in the above code.
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
|
|
|
|
|
sorry i posted wrong code
CString CurrentPath = _T("C:\\test.exe");
CString para = _T("c:\\test.ini");
ShellExecute(NULL,_T("open"),CurrentPath,para ,NULL,SW_SHOW);
what i want is i want to access para value in my test.exe code
|
|
|
|
|
Hi,
it depends on language and compiler.
Most often you can get the command line as a string and/or the command line parts as a
string array; look for:
- the (optional) arguments of your main or WinMain function;
- a library function such as GetCommandLine.
BTW: When an array is returned, most likely the first element is the path of the EXE itself.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi there,
I am currently now beginning to learn C++. As i am new i will keep editing the program and do compilation for quite a number of times. It seems that every time i do it for more than 5 to 6 times the program will start to hang and i cannot compile nor stopping the compilation. Kindly assist me on this matter, really appreciate it.
Regards
|^-^| Willing to Learn is the light to my life |^-^|
|
|
|
|
|
Do you mean Visual Studio IDE hangs? Then you probably have to install it again.
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 here! CPallini there! CPallini everywhere!
Thank U CPallini!
|
|
|
|