|
Hello John
I am creating a Win32DLL in which i am passing the address of a function like
extern "C" __declspec(dllexport) BOOL ReadCard(char *pData)
{
if(g_hPort == NULL)
{
strcpy(pData,"COM port is not opened");
return false;
}
g_hThreadRead = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MyMSR_PortReadThreadMgr, 0, 0,&dwThreadID);
return true;
}
But this thread is created but not executing the functions. I have declared the function like
DWORD WINAPI MyMSR_PortReadThreadMgr(LPVOID param)
{
}
But it is not going to this function can you suggest me some thing
Thanks in advance
Shailesh
CeateThread(
|
|
|
|
|
aman2006 wrote:
But this thread is created
How did you check this?
aman2006 wrote:
But it is not going to this function
And this ?
Code seems fine to me..
Bikram Singh
I believe we should all pay our tax with a smile. I tried - but they wanted cash.
|
|
|
|
|
I am creating a view in a splitter which has a titled opengl scene, but I can't fix the problem of repainting the window when parts (the text..) are obscured.
Note: I want the window text to be separate from the opengl rendered scene.
Right now, I am drawing the text using DrawText after the scene is rendered. Unfortunately, when the text is covered it does not repaint in the window. I thought the best solution would be to use a virtual window, but I have had problems with that. At first I tried to just store the title text in the virtual window and paint it on the opengl scene (since the opengl seems to have no repainting issues), but that did not work. My other thought was to put the opengl scene and the text into a virtual window, but I'm not sure how to draw the opengl scene to a virtual window. Is there a "proper" way to solve my problem? Any help or links to helpful pages would be appreciated. Thanks.
|
|
|
|
|
i'm writing a program that reduces fractions...the only problem is i don't know how to do this...help please
-b
|
|
|
|
|
That was funnier than the JOTD I just read in the lounge
Your great...come back soon eh
Cheers
How do I print my voice mail?
|
|
|
|
|
It's actually quite simple. All you have to do is write a function to find the greatest common divisor of two numbers. That would be the largest number which divides both numbers evenly. For example, 3 is the greatest common divisor of 6 and 9 because 6/3 = 2 and 9/3 = 3, but no number larger than 3 evenly divides 6 and 9. One way to do this would be to simply try and divide both numbers by every number between 1 and the largest of half of each number. For example, with 6 and 9, your greatest common divisor (GCD) function would divide 6 and 9 by 1, 2, 3, and 4 because half of nine (4.5) is greater than half of six (3). Of course, we are looking for whole number divisors so we need only try up to 4 not 4.5.
The reason you need only try these is because a number, n, divided by itself is 1 and a number divided by half of itself is 2. Every other number between n/2 and n will result in something between 1 and 2 when divided into n (Try it if you don't believe).
The largest number which yields whole numbers when both numbers are divided by it will be the greatest common divisor. The new numerator is the old numerator divided by the gcd and the new denominator is the old denominator divided by the gcd.
Another way to do this is the Euclidean algorithm, if you know what that is.
Finally, you could add a little more to deal with mixed numbers as well, but I think I'll stop here.
|
|
|
|
|
This is easy, just make a list of the prime factors of each number, and then divide out all the common prime factors.
remember though that 2 is a factor of 8 twice, and 16 3 times! This is a small detail your program will need to account for.
Unfortunatly nobody knows of any good algorithm for finding the prime factors of a number. (they can do a little better than trying all numbers one at a time, but not much) So you get to start back in your math books and see if you can do better than some of the smartest people on earth and come up with something. (Although this sounds impossible, nobody has proven it can't be done, and every once in a while some new brain will look at a problem and come up with a solution)
Note that your professor will give you and A for the class (not the assignment, the class!) if you can come up with a good way to find prime factors.
|
|
|
|
|
Hi experts,
Using MFC , VC++ 6.0 ...
I have a DialogWindow with a CListCtrl derived Control called CInfoListCtrl.
class CInfoListCtrl : public CListCtrl ....
This uses an editfield (CEdit derived) which sends a notificationmessage to its parent:
(parent is the CInfoListCtrl-window )
CColEdit:
GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr);
So the parent should catch this with
ON_NOTIFY( LVN_ENDLABELEDIT, <idof editfield=""> , OnEndLabelEdit)
Thsi doessnt work !!! Ive to use :
ON_NOTIFY_REFLECT(LVN_ENDLABELEDIT, OnEndLabelEdit)
_in the parent window_ ???? WHY ????
The 2nd. question:
From the Parent (CInfoListCtrl) I tried to send the Not.Message to the Dialog (its parent).
This Dlg Window never receives the WM_NOTIFY - so WM_NOTIFY is reflected back to CInfoListCtrl
so
ON_NOTIFY(LVN_ENDLABELEDIT, IDC_VERKINFO_VALUES, OnEndlabeleditVerkinfoValues)
never handles any messages
Looking at code samples I found out, that there are some ListCtrls using this similar mechanism - the also use ON_NOTIFY_REFLECT to handle the editfields messages.
So are TN061 and TN062 not correct ?
(or is my brain still working in PERL , not VC++&MFC )
** n
|
|
|
|
|
I found the answer myself -> sorry for bothering you
It was an older code and when I developed it I want to treat the CInfoListCtrl like the listctrl.
So the Editfields sends the notification message BUT WITH
hwndFrom = GetParent()->GetSafeHwnd();
(The same as the CListCtrl does when editing a label)
Now I inserted the messagehandling for the Editfield into the CInfoListCtrl and not the Dialog anymore ->
Looking at the SendMessage command in the Editfield code:
GetParent()->SendMessage(WM_NOTIFY, ....)
Oh - tho whom its sending the message ? to the CInfoListCtrl(its parent window) but
this never received WM_NOTIFY (now I know why )
(The notify msg handling seems to be very starnge ...)
2nd mistake:
After implementing ON_NOTIFY_REFLECT in the CInfoListCtrl
I was lucky for at least 2 minutes.
This because the CDialog class never receives a WM_NOTYFY ->
looking at TN061 -> "WM_NOTIFY_REFLECT overrides WM_NOTIFY"
Now everything semms to be clear .....
NO, NOT EVERYTHING !
Whats about :
GetParent()->SendMessage(WM_NOTIFY, ....)
Why (OK why is a not allowed type of question )
Why does MFC ignore the instance of the message sender and uses hwndFrom of the notif.msg structure hdr instead ?
Can I send this message _from_ anywhere ?
** (n/4)
|
|
|
|
|
How to capture data send to printer by for example Word ?
Because I want then display the preview of that document in my application.
I use virtual printer (ms publisher virtual printer).
Main questions are: how to capture data and what is this data format (to be able to display it properly) :>
Solutions can be based on -> C#, vc++.
Help 
|
|
|
|
|
Hey all, maybe someone out there can help me. I need a MFC Grid or ListCtrl, with source, that has the ability to have columns with both a check box and an edit contol in the same column. I would like to have the check box enable or disable the edit control. It also has to be able to notify it's parent window of any changes in the check state. A quick mockup pic of what I am looking for can be found at http://www3.telus.net/pja/GridConcept.png[^]
If anybody has a link to such a beast I would be appreciative, else I will have to attempt to roll my own.
Thanks
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Have a look at Chris Maunder's Grid, I think you can easilly create new custom cell types.
M.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Chris Maunder's Grid is great and if u can get to do what u need its the best .
if not u can check DataDynamic's SharpGrid. Its possible with #grid to do what u need but its paid .
|
|
|
|
|
Can anyone tell me what exactly is the difference between these two lines?
System::Console::Write("Foo");
System::Console::Write(S"Foo");
I'm having a very difficult time unearthing anything on this anywhere at all...
I know what the L character does for the wchar_t type, but what does the S character do????

|
|
|
|
|
AFAIK it is the exact opposite of L. It forces the string literal to be of type char_t.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
This is completely doing my head in!
I've written some code which nearly works, but I can't quite sort out dragging/moving of my "splitters", in some cases it moves other splitters that it shouldn't, my structure is a tree.
It's got to the point now where I've convinced myself that my method isn't right and wont work. For what it's worth my docking interface mimics the ".NET" docking windows.
Does anybody have any information on what sort of structures I should be looking at and what specifically are the rules that "VS .NET" using for it's docking windows (i.e sizing the window).
It's real annoying that every implementation of this I've come across is MFC based (commercial or otherwise). I'm trying to give our product a new interface (which is straight 'C' API, not even C++).
I've been doing this in my spare time, but it's got to the point where I'm going to chuck it all away and start again. Any tips or info gratefully recieved.
Adrian
|
|
|
|
|
Is there another way to catch the ctrl-c combo other then signal(SIGTERM, func)? Thanks.
|
|
|
|
|
i have never heard of signal()
but you could use GetAsyncKeyState() and/or GetKeyState()
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/getasynckeystate.asp
http://msdn.microsoft.com/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/GetKeyState.asp
|
|
|
|
|
At some point during development, tool tips stopped working for the buttons on my tool bars. If the mouse is moved over a button, nothing happens. If the button is clicked then tooltip text does appear at the bottom of the window, as long as the button is held down.
May I ask if anyone has had a similar experience, and whether they have figured out the cause?
Any input appreciated.
Thanks.
|
|
|
|
|
Possibly your string identifiers do not correlate with the numeric values of the command identifiers for your tooltips any more.
I noticed this when I created the tooltip and string at same time, and later changed the actual value of the command ID, then the strings in the resource string table still had the OLD identifiers, I had to go in and change them manually to match the new command identifiers the tools were using.
|
|
|
|
|
I appreciate your feedback, but I have not changed the values of the identifiers.
Also, since the correct button description is displayed when the button is held down, it would appear that the association is correct.
The problem is related to the failure of mouse movement to invoke an appropriate function. When the mouse enters and leaves the "window" of the button, there are surely events that need to be processed, but are not.
Thanks
|
|
|
|
|
Did you inadvertently intercept messages anywhere in the message loop chain? There are some special functions for making this all work, if you are using MFC, such as
CWnd::FilterToolTipMessage
Called by the framework to display the tool tip message associated with a button on the toolbar.
void FilterToolTipMessage(MSG* pMsg);
Parameters
pMsg - A pointer to the tool tip message.
Remarks - It is normally called from PreTranslateMessage.
Call it when the framework does not call it for you.
See Also CWnd::OnToolHitTest
Maybe this got bypassed with your recent development efforts?
Just trying to help.
|
|
|
|
|
That is some good thinking.
I should have posted that I "solved" this problem.
First of all, it turned out that tooltips did appear every once in a while, maybe once out of 50 times that the cursor was moved over the button.
In an effort to solve the problem, I started getting earlier versions of my source code out of Source Safe, and each time, the tool tips worked.
Finally, I got to where there was a trivial difference between the "current" source and the source that did not work, a difference that could not matter, it seemed to me.
Let me mention here that I did "rebuild all"s on the "current" version, which did not help.
Finally, I checked out the current version of the code to a fresh directory. In other words, I checked out code identical to the source code which exhibited the problem. When I built the project, tool tips worked!
I will say that I do not check in .dsw, .clw, or any of the "project" files, other than .dsp (well, .rc and resource.h are checked in, of course).
I simply do not know. It seems so odd to me. I never did try deleting all the files from the "debug" or "release" folders, rather than just doing a rebuild all.
Perhaps it was evil electrons.
|
|
|
|
|
Hi,
I have an application in MFC. When a CButton is created in a dialog, its OnBnClicked... function is called properly when the check box (of type CButton) is clicked. However, when in the code I calll SetParent() of the CButton and set its parent to another window (so that it can take the Tab stops from another dialog) then the OnBnClicked... function is no longer called!!
It seems to be happening only for CButton. Event handlers for CCheckList and CEdit work perfectly even after changing their parents.
Any thoughts? Please let me know ASAP.
Thanks.
|
|
|
|
|
I'm using the following simple code to write to the registry, but for some reason I'm getting non-printable characters in the registry:
<br />
class CRegKey* rc = new CRegKey(HKEY_LOCAL_MACHINE);<br />
<br />
rc->Open(HKEY_LOCAL_MACHINE,"Path\\to\\key");<br />
rc->SetStringValue("Name","CMS Document and Media Server");<br />
rc->Close();<br />
delete rc;<br />
What shows up in the registry follows:
CMS Document|and|Media Server
Both the |'s are actually non-printable characters. Any ideas about what's going on?
Thanks.
--Kaleb
|
|
|
|