|
I am getting "C" in the outputstring
|
|
|
|
|
ptr_Electron wrote: I am getting "C" in the outputstring
you mean even while the main thread is processing, you are getting the string you wrote in the outputdebugstring?
|
|
|
|
|
No, I am not getting when mail thread is processing, Is there any work arounds for this
|
|
|
|
|
ptr_Electron wrote:
it is woking fine untill a specific function call is reached. and during the execution
of that function, say for about 1 min, the OnTimer is not called, after the function call, it is working
normally.
Because your gui thread is busy in your function call. Only after that next message from message queue will be processed.
If the timer event is so critical for you, better go for waitable timer kernel object. You've to spawn a new thread and should wait for the timer on that thread. This link might be helpful -
http://msdn.microsoft.com/en-us/library/ms687012(VS.85).aspx[^]
http://www.adp-gmbh.ch/win/misc/timer.html[^]
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks for ur responce, It tried it out, but no luck
|
|
|
|
|
Did you created a separate thread for waiting on the timer?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
yes I created separate thread
|
|
|
|
|
Thanks you very much, it is done, but one short question....
I am updating the progressbar, but once the window is minized it is in the frized stated till the currnet operation is done, just I want to make the UI active, just like, redraw window incase in min and maximiwed, some thing...
I tried with some thing like DoEvents() in it, but now luck...
|
|
|
|
|
Hello everyone,
For the interface of a coclass, we can use the interface pointer to point to not only the coclass instance itself, but also pointing to the proxy for the original coclass (during marshalling).
My question is, does it mean the proxy class has the same memory signature as the coclass itself? If not, what are the differences between them and why we can use the same pointer to point to different memory signature?
thanks in advance,
George
|
|
|
|
|
George_George wrote: does it mean the proxy class has the same memory signature as the coclass itself?
If by "memory signature" you mean the layout of the interfaces and the behaviour of QueryInterface , then the answer is yes.
Steve
|
|
|
|
|
Thanks Steve,
1.
If we call QueryInterface on proxy object, we just query the interface of the proxy, not the actual original object, correct?
2.
Stephen Hewitt wrote: you mean the layout of the interfaces and the behaviour
Sorry my bad English is confusing. My confusion is why the same type of interface variable could be pointed to different types -- original coclass type and proxy object type?
regards,
George
|
|
|
|
|
George_George wrote: If we call QueryInterface on proxy object, we just query the interface of the proxy, not the actual original object, correct?
Yes, but as I said, the proxy will implement the same set of interfaces as the real object and as long as you follow the COM rules you will not notice any difference.
George_George wrote: Sorry my bad English is confusing. My confusion is why the same type of interface variable could be pointed to different types -- original coclass type and proxy object type?
Because, from a C++ point of view, an interface is a abstract base class: different object can implement the same abstract base class but they all can be pointed to by it.
Steve
|
|
|
|
|
Thanks Steve,
Let me confirm with your comments. Since both proxy object implements the same set of interfaces as the original coclass object, we can use the same interface variable to point to both proxy object and original coclass object, correct?
regards,
George
|
|
|
|
|
Yes, that's what interfaces are for. In C++ an interface is a pure abstract base class.
Steve
|
|
|
|
|
Thanks Steve!
Question answered.
regards,
George
|
|
|
|
|
there is a bits field structure like this:
typedef struct _bit_struct{
unsigned int sync:16;
unsigned resv:3;
union{
unsigned network_id:13;
unsigned map_id:13;
};
}bit_struct;
Any problem? Maybe union couldn't be included in bits field structure? because when i access(write) the union field, i find it writes wrong address(according to its assembly code).
thanks
|
|
|
|
|
be sure you have structure alignment set to one with the "pack" #pragma.
#pragma pack(1)
typedef struct _bit_struct{
unsigned int sync:16;
unsigned resv:3;
union{
unsigned network_id:13;
unsigned map_id:13;
}bit_struct;
|
|
|
|
|
the problem remains.
but its strange that when i use named union line bellow:
typedef struct _bit_struct{
unsigned int sync:16;
unsigned resv:3;
union id{
unsigned network_id:13;
unsigned map_id:13;
}bit_struct;
then, i write the union value like this:
bit_struct st;
st.id::network_id=**;
all will be ok. I am puzzled.
|
|
|
|
|
Hi All,
I'm porting my neat little C++ application written in win32/minGW to MSVC9/MFC. My old WindowProcedure function for message handling compiles, but doesn't actually work anymore at runtime. So I am learning how to handle events the MFC way.
I've declared a function in my dialog application's class declaration like so:
afx_msg LRESULT OnMyUserMessage(WPARAM wParam, LPARAM lParam);
But as soon as I add
ON_MESSAGE( WM_USER+1, OnMyUserMessage)
to the message map in my cpp file, I get the following linker error:
error LNK2001: unresolved external symbol "protected: long __thiscall CMyAppDlg::OnMyUserMessage(unsigned int,long)" (?OnMyUserMessage@CMyAppDlg@@IAEJIJ@Z)
Been scouring the boards now and a lot of people have had problems with casting but I can't find any instances of this. MSDN page says for ON_MESSAGE you need to include the afxmsg_.h header: did this and no change.
The mingw linker and I had just become friends! Any suggestions as to how to resolve this?
|
|
|
|
|
I think you should define your specified MSG like:
in your UsrMsg.h or .h file anywhere
<br />
#define UM_MY_MSG WM_USER + 10
secondly, use ::SendMessage to consume the message:
::SendMessage(pWnd->GetSafeHwnd(), UM_MY_MSG, NULL, NULL); //Let's assume pWnd is a CMyDialog instance
thirdly in CMyDialog to map the UM_MY_MSG message
BEGIN_MESSAGE_MAP(CMyDialog , CDialog)
<font color="blue">ON_MESSAGE(UM_MY_MSG, OnDealMsg)</font>
END_MESSAGE_MAP
forthly implement the OnDealMsg method! Hope it helps!
modified on Tuesday, August 5, 2008 10:15 PM
|
|
|
|
|
The OnMyUserMessage() method has to exist for the link to succeed.
You should also base your messages on WM_APP (or a registered window message)
instead of WM_USER to prevent conflicts with window messages used by MFC.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks guys, I'm back up and running now thanks to your suggestions. Mark's hint to change the message to WM_APP seemed to do the trick!
|
|
|
|
|
How do I alter the mfc image icon - (on the top left corner of all programs)
I have tried to do this in the resource - icon - idr_mainframe section
but nothing is implemented when I modify the image
Thanks
Simon
|
|
|
|
|
After the window is created, you can use something like
hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
hIcon = ::LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
::SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
::SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Keep in mind that an Icon resource can contain multiple images in many sizes and color depths. The operating system attempts to load the best icon for the situation. In your case, you may have edited the 32x32 icon but not the 16x16 icon used for the upper left corner.
|
|
|
|