|
because you might be careful to the this pointer implicitely added to the header of a member function...
it is the same as CallBack functions
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Functions used to be created as threads are defined as "static" when used with a C++ Class because there is an implied parameter that doesn't show up in code, the THIS pointer.
To avoid this confusion and make it simple "static" class members only operate on static data and not per-instance data and as such the "this" pointer is not passed in. So, it's easy to define the function as static and use it in CreateThread without worries. Of course they usually pass the object instance as the first parameter anyway.
class x
{
public:
static DWORD WINAPI MyThread(PVOID lParam)
{
x *pX = (x *)lParam;
}
}
...
x pX = new x;
CreateThread(...., x::MyThread, pX);
As you see in the above example the thread can be created and the system will pass in the "this" pointer and we will manually re-use it.
Another way to do this in the C++ is to simply define a class function to be standard call, NOT FAST CALL, and take "void" parameters.
class x
{
public:
DWORD WINAPI MyThread(void);
};
...
x *pX = new x;
CreateThread(..., x::MyThread, pX);
Why void parameters?
Because the system will now pass in the "this" pointer for you and in C++ the language hides this detail anyway.
Why stdcall and not fastcall?
STDCALL should pass the "this" pointer on the stack while fastcall passes the this pointer in ECX register, which the system has no idea about.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
thanks for ur explaination... so nice and clear..
vivek
|
|
|
|
|
Repsected all
Regards!
I am David from Denmark and have a problem relating to VC++.
" How to display Digital Data on a Electric Crciut(which is just a bmp file) where i want that when the CURRENT value exceeds from some specific value the coming resister in his path Change his color and then repeat the same process.
kindly guide me.
Best wishes
David
david
|
|
|
|
|
|
Respected all
Regards
I have a problem in VC++.
" I have a Bitmap in the form of Electric Circuit and i did programming for it when current flowing through it it shows the calculated current from V=IR formula,in this i took the volatge as random value after one second change his value and with this all the current that flows throgh the circuit changed his value from the above formula.
But now i want that when current exceeds from some limited value the Resister coming in the remaining circuit change his color and again reset when current
kindly guide me.
Best wishes.
David
david
|
|
|
|
|
Hi all,
I have a third party dll.I only have the .dll file(no .h or .lib) file.I want to use the classes and the functions of that dll in a dialog based application in vc++.Please help me to solve my problem.
Thanks
Harsha
|
|
|
|
|
You will have to link to the lib in project-> properties in order to build it so that your client application can locate all the entry points to the DLL.
Can you get acess to the lib?
|
|
|
|
|
I've upgraded a series of Doc/View MFC VC++ 6 projects in a worspace to VC++ 7.1
The compile fine and start up fine showing the views etc, but when I try to bring up any dialogs including a standard MessageBox I get a crash in Debug build inside WinCore.cpp. The comments in code seems to suggesst that an ASSERT has happened while handling an ASSERT. Can't spot anything though in the call stack to suggest why it would happen.
Anyone seen anything like this on a project upgrade?
|
|
|
|
|
|
My application just hangs when run in Debug within Visual Studio 7.1.
I have tried to find the change that caused this problem but failed so far. I think I may have suffered a crash during an editing session - but not sure.
The Task Manager reports cpu ~ 99% for devenv.exe and when I End of Process I get the message:-
'The application failed to initialse properly ...'
Now the application seems to run OK when you double click the myProgram.exe icon.
But seem to have lost the ability to run and debug my program within the Visual Studio IDE.
Has anyone come across this problem before?
Other programs seem to be able to be run and debuged OK, its just this one. I have done a clean rebuilt - help.
|
|
|
|
|
|
I'm trying to gain access to a network disk using WNetConnectionDialog (first time that I've used it !) but cannot see how to retrieve the values selected by the user. Any help appreciated !
Doug
|
|
|
|
|
DougButtimer wrote:
...but cannot see how to retrieve the values selected by the user.
There won't be any. From MSDN:
If the user clicks OK in the dialog box, the requested network connection will have been made when the WNetConnectionDialog() function returns.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Is there some way to retrieve this info from the system itself then ?
Doug
|
|
|
|
|
What information are you wanting to retrieve?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The path to the remote disk drive selected by the user. How can I do this ?
Doug
|
|
|
|
|
Try:
CONNECTDLGSTRUCT cds = {0};
NETRESOURCE nr = {0};
nr.dwType = RESOURCETYPE_DISK;
cds.cbStructure = sizeof(cds);
cds.hwndOwner = GetSafeHwnd();
cds.lpConnRes = &nr;
WNetConnectionDialog1(&cds);
TRACE(_T("dwDevNum = %lu\n"), cds.dwDevNum);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
I want to show CToolTipCtrl object when user enters invalid character. Actually i want to use that class when i want. But i cant find a solution. Is there anyway to override that functionality.
I use several methods, but cant do what i want.
I use ShowWindow like funtctions, but they just show and disappear. They dont even there for a few miliseconds
Being mortal is what makes impossible possible.
|
|
|
|
|
i)declare CToolTipCtrl in ur class
like CToolTipCtrl m_ToolTipCtrl ;
ii) add the following code in constructor
TOOLINFO ti;
DWORD dwStyle = TTS_BALLOON;
m_ToolTipCtrl .Create(this, dwStyle);
m_ToolTipCtrl .FillInToolInfo(ti, this, 0);
ti.uFlags |= (TTF_TRACK |TTF_ABSOLUTE );
ti.lpszText = (LPTSTR)_T("Enter Valid Phone number");
m_ToolTipCtrl .SendMessage (TTM_ADDTOOL, 0,reinterpret_cast<lparam> (&ti));
iii) add the following code, where u want to show the tooltip
LPTSTR lpszMessage = _T("Enter Tooltip text here");
m_ToolTipCtrl.Activate(TRUE) ;
CToolInfo ti;
m_ToolTipCtrl.GetToolInfo(ti, this, 0);
ti.lpszText = lpszMessage;
m_ToolTipCtrl .SetToolInfo(&ti);
m_ToolTipCtrl .SendMessage (TTM_TRACKPOSITION, 0, MAKELPARAM(rect.right - 20, rect.CenterPoint().y));
m_ToolTipCtrl .SendMessage (TTM_TRACKACTIVATE, TRUE,reinterpret_cast<lparam>(&ti));
this code i got from some post
for more info follow this link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/usingtooltips.asp
naren
VC++ programmer
|
|
|
|
|
narendra_ b; thank you very much for your help. I've been working on it for hours but couldn't find the solution.
Your code works very good.
|
|
|
|
|
hi
Suppose I want an application which takes a source file and outputs its data members and functions.
Supposed to develop into a kind of class view explorer.
Regarding parsing the source file ....
should i go for using regular expressions rules for this parsing or
should i go for a language representation in context free grammer[CFG] and use the CFG rules for parsing
or is there any other possible ideas for source file parsing
awaiting advice
fordge
|
|
|
|
|
For something with fixed syntax rules such as a programming language, I would go for a CFG, since parsing it with pure regex can be relatively complicated.
Search Code Project for context free grammar to get more information.
Hope this helps.
~RaGE();
|
|
|
|