|
|
Please let we know the error message ('compiler error' is a bit vague). Anyway I guess you are making a UNICODE build hence the ctor CString::CString(const char *, int) is not available. If the character array is zero-terminated (or you can make it zero-terminated and there aren't other '\0' characters inside) then you could use CString::CString(const char *) instead, namely
CString str(array);
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
[My articles]
|
|
|
|
|
VCProgrammer wrote: char array[620];
CString str(array,620);
Why are you writing that piece of code?
If you want the str object to be initialised with the array contents, you just have to say CString str(array);
Also, if you're talking about a compiler error or so, you should provide the exact details so that others don't have to guess what would that be.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
How can i add a context menu to an edit control?
I try to handle WM_RBUTTONDOWN in the main window, but don't work if the mouse click is on the edit control.
|
|
|
|
|
You have to subclass the Edit Control, see, for instance Create your own controls - the art of subclassing[^].
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
[My articles]
|
|
|
|
|
Derive a new class from the CEdit and handle the ON_WM_CONTEXTMENU() message.Check this article for referance,
<href="http: www.codeproject.com="" kb="" edit="" cmenuedit.aspx"="">How to modify a CEdit context menu[^]
http://www.mono-project.com/Main_Page
|
|
|
|
|
I'm not using MFC.
So i've to call SetWindowSubclass function and set my own EditProc in which handle WM_CONTEXTMENU?
|
|
|
|
|
Member 2965471 wrote: So i've to call SetWindowSubclass function and set my own EditProc in which handle WM_CONTEXTMENU?
Yes.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
As an alternative to the mentioned subclassing, it is also possible to handle WM_RBUTTONDOWN directly in your dialogs message loop:
HWND hwndDlg = CreateDialog(...);
MSG msg;
while(GetMessage(&msg,0,0,0)){
if(msg.hwnd == GetDlgItem(hwndDlg,ID_MYEDITCONTROL) && msg.message == WM_RBUTTONDOWN)
;
else{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Hi All,
I have a doubt.
PostMessage() will post the message and returns immediately won't wait for Message to complete.
where as SendMessage() will post the message and will not return till the message is completed.
My doubt is why we have to wait in SendMessage() till the message is completed.
Can any body can clarify my doubt?
|
|
|
|
|
Sometimes we need to know the retult of the message and using the return value or wparam or lparam of the message.
Take WM_GETTEXT as an example.
Only after the destination window processed this messasge and filled the lparam with it's text,can our program do something accordingly.
In such case we must use SendMessage.
|
|
|
|
|
|
SendMessage() is a synchronous call, meaning it waits for the code and result of the operation (framework equivalent of making a blocking function call), whereas PostMessage() is asynchronous, meaning there's no waiting for result.
Where is either useful?
-SendMessage() : Your continuation of execution depends on the result of the operation and/or the CWnd's lie in the same thread (blocking calls are a non-issue).
-PostMessage() : Non-blocking is essential, such is the case for threaded programming.
|
|
|
|
|
how to mdichildframe in pane of splitter aplication in vc++
|
|
|
|
|
Your question is not clear, please add some more detail about what you are trying to achieve.
The best things in life are not things.
|
|
|
|
|
Can you please re-phrase your query? Is not clear on what you are asking. make it a little elaborate.
|
|
|
|
|
|
From MSDN page for WM_ACTIVATETOPLEVEL
http://msdn.microsoft.com/en-us/library/xkd95027(VS.80).aspx
I got the below description:
This message is similar in use to WM_ACTIVATEAPP, but works in situations where windows belonging to different processes are mixed in a single window hierarchy (common in OLE applications).
Does anybody know where is a example/demo/document available that illustrate "windows belonging to different processes are mixed in a single window hierarchy"?
I googled but found almost nothing.
Thanks!
|
|
|
|
|
Since they mention OLE, you could start there perhaps...
Compound Documents[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks!
I think I got the basic idea.
Just like embeded MS Word into your_app, the embeded MSWord view window is a chid window of your_app.exe but it's essentially relaies on a external process WinWord.exe
|
|
|
|
|
i registed my message on DlgMain WM_PK_MESSAGE by RegisterWindowMessage
and i have a DLL..have InjectDLL Function callback to a wndproc
i want my DLL get WM_PK_MESSAGE..
can you have some ideas for me
tk so much
|
|
|
|
|
Hi,
In each process you using the registered message, you should first call
WM_PK_MESSAGE = RegisterWindowMessage
and then you can use the WM_PK_MESSAGE.
|
|
|
|
|
You also need to use the ON_REGISTERED_MESSAGE macro instead of the normal ON_MESSAGE e.g.
BEGIN_MESSAGE_MAP(CMyWnd, CWnd)
ON_REGISTERED_MESSAGE(m_nRegMsg, OnRegisteredMessage)
END_MESSAGE_MAP()
|
|
|
|
|
Hi,
I got a ball hitting a paddle and I want it's X velocity to increase/decrease depending on where it hits the paddle. The code below works with whole numbers but not for numbers like "0.67" or "2.45". I'm looking for a way to animate objects moving at smaller increments for better precision. Thanks.
int speed=Ball_List[b]->speed;
int paddle_center = Player->Location.X + Player->Width / 2;
int ball_center = Ball_List[b]->gameBall->Location.X + Ball_List[b]->gameBall->Width / 2;
int paddle_location = ball_center - paddle_center;
double a=(90-paddle_location);
double angle = (Math::PI / 180) * a;
Ball_List[b]->xVel = speed*Math::Cos(angle);
Ball_List[b]->yVel = -speed*Math::Sin(angle);
Ball_List[b]->gameBall->Location = Point(Ball_List[b]->gameBall->Location.X + Ball_List[b]->xVel, Ball_List[b]->gameBall->Location.Y + Ball_List[b]->yVel);
[/code]
|
|
|
|
|
Can you tell us what doesn't work when you use non-integers. And non-integers for what?
|
|
|
|