|
in case you dont want to make variable static you can do following in the constructor.
float _front[4][3] = {{1.0f, 1.0f, 1.0f},{-1.0f, 1.0f, 1.0f},{-1.0f,-1.0f, 1.0f},{1.0f,-1.0f, 1.0f}};
memcpy(front, _front, sizeof(float)*12);
-Saurabh
|
|
|
|
|
How do I implement this?
tCircle::tCircle( double fNewX, double fNewY, double fNewRadix )
: cCenter.fX( fNewX ),
cCenter.fY( fNewY ),
nRadix ( fNewRadix )
{
}
I get the error "error C2059: syntax error : '.'" at "cCenter.fX( fNewX )"
regards
hint_54
-- modified at 20:24 Friday 14th April, 2006
|
|
|
|
|
If your class looks like this:
class tCircle
{
double fX;
double fY;
double fRadix
public:
tCircle( double fNewX, double fNewY, double fNewRadix );
};
Constructor implementaiton could be:
tCircle::tCircle( double fNewX, double fNewY, double fNewRadix )
: fX( fNewX ),
fY( fNewY ),
nRadix ( fNewRadix )
{}
gmileka
|
|
|
|
|
No. I have
class tDot {
public:
float fX, fY;
};
class tCircle {
public:
tCircle( void );
tCircle( float, float, float );
tCircle( tDot, float );
public:
float fRadix;
tDot cCenter;
};
I'm having trouble with the 2nd constructor.
Thx
hint_54
|
|
|
|
|
I would add a constructor to tDot.
class tDot
{
public:
float fX, fY;
tDot(float newfX, float newfY){ fX=newfX; fY=newFY; };
};
class tCircle {
public:
tCircle( void );
tCircle( float, float, float );
tCircle( tDot, float );
public:
float fRadix;
tDot cCenter;
};
tCircle::tCircle(double newX, double newY)
: cCenter( newX, newY)
{
}
gmileka
|
|
|
|
|
That's it! thx
hint_54
|
|
|
|
|
You should either use cCenter(fNewX, fNewY), assuming tDot have a constructor accepting two arguments or move cCenter.fX and cCenter.fY within the function body.
-Saurabh
|
|
|
|
|
thx
hint_54
|
|
|
|
|
I am working win WinAPI (not MFC!). Created RichEdit control and it works fine except one small problem. If user select some text in RichEdit control and hit Ctrl+C - nothing goes to clipboard.
Here is creation code:
if (SearchPath(NULL, "RICHED32.DLL", NULL, sizeof(sBuf), sBuf, &s)>0) {<br />
hRE_Lib = LoadLibrary("RICHED32");<br />
} else if(SearchPath(NULL, "RICHED21.DLL", NULL, sizeof(sBuf), sBuf, &s)>0) {<br />
hRE_Lib = LoadLibrary("RICHED21");<br />
} else {<br />
hRE_Lib = NULL;<br />
}<br />
if (hRE_Lib == NULL) {<br />
MessageBox(NULL, "Can not find RichEdit library!", "Error!",<br />
MB_ICONEXCLAMATION | MB_OK);<br />
return 0;<br />
}<br />
<br />
hRichEdit = CreateWindowEx(<br />
WS_EX_CLIENTEDGE,<br />
"RICHEDIT", "",<br />
WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL |<br />
ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | ES_READONLY,<br />
1,1,50,100,<br />
hwnd, NULL,<br />
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),<br />
NULL);<br />
<br />
if(hRichEdit == NULL) {<br />
MessageBox(NULL, "Rich Edit Creation Failed!", "Error!",<br />
MB_ICONEXCLAMATION | MB_OK);<br />
return 0;<br />
}<br />
SendMessage(hRichEdit, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE);<br />
Right now, I am thinking about using
SendMessage(hRichEdit, EM_SETEVENTMASK, (WPARAM)NULL, (LPARAM)ENM_KEYEVENTS);
with some code in WndProc which would wait for Ctrl+C and send selected text from RichEdit to clipboard. But may be problem can be fixed more easy?
BTW Ctrl+A already works in my RichEdit control, so I do not understand why Ctrl+C do not work by default. There is only simple text. I am adding it by command SendMessage(hRichEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)TextBuffer);
|
|
|
|
|
Hi Folks,
I have a little problem..
I created an MFC app wizard application and ran it successfully...
The problem is when i add some header (.h files) along with their implementatio files(.cpp) to the project while compiling follwing error message is displayed...
indicating error in implementation files...
fatal error C1010: unexpected end of file while looking for precompiled header directive
MapNode.cpp
I have seprately compiled and tested these files successfully.. but the problem occurs when i add these files to my project....
Waiting for your response...
Regards,
JinBaba
|
|
|
|
|
|
|
Hi,
Can anyone tell me if it is possible to check if a program is running remotely ( using remote desktop ) or locally.
Is there any win32 API calls to detect this?
regards,
Easen.
|
|
|
|
|
BusaBird wrote: Can anyone tell me if it is possible to check if a program is running remotely ( using remote desktop )...
Sure. Once you have access to the other machine's desktop, simply open Task Manager.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Can a program detect this automatically?
I ve written a program to be used only locally. I want to detect if someone try to start it using remote desktop. If this is the case, the program must show an error message and close it self.
I know that there are ways to do it using the Windows 2003 access settings. But I need the program to detect it automatically.
-- modified at 4:54 Monday 17th April, 2006
|
|
|
|
|
I do not currently know of a way for a program to detect if it is running locally or from within Remote Desktop.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
When Visual Studio creates a Dialog Based C++ program it creates projectDlg.cpp and projectDlg.h.
How can a global function call a member function of the projectDlg class?
The glogal function is defined in projectDlp.cpp.
Thanks,
Kevin
|
|
|
|
|
EW_dude wrote: How can a global function call a member function of the projectDlg class?
get an instance of that object type, or make the member function static .
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I tried the static approach. static void disp();
But to get the global function to compile I had to type
projectDlg::disp(); Got it to compile.
But now disp() doesn't see any of the variables of the class. I get "illegal reference to non-static member" when I try to set a variable.
Any ideas?
|
|
|
|
|
EW_dude wrote: But to get the global function to compile I had to type
projectDlg::disp(); Got it to compile.
Of course. This is how static member functions work.
EW_dude wrote: But now disp() doesn't see any of the variables of the class.
Because they are not static . Read up on what static means in a class.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
EW_dude wrote: Any ideas?
give your global function a pointer to the dialog. the very simplest way to do this is to just create a global variable to hold that pointer, then have your dialog set it (maybe in the dialog's constructor - and be sure to set that pointer to NULL when the dialog goes away)
then you can do:
CMyDialog *g_pDialog = NULL;
void MyGlobalFuncion
{
if (g_pDialog)
g_pDialog->memberFunction();
}
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
No matter what types of project (dialog based, Doc/View ...) you are working or what types of tools (VC++, C++ Builder, ...) you are using, you are using the C++ Language. Everything just follows the rule of the C++ Language.
So you may just search for where the auto variable of type class CProjectDlg is. And then you know what to do.
For example:
void g_MyGlobalFunction(CProjectDlg* p) { }<br />
CProjectDlg* g_pTheDlg = NULL;<br />
BOOL CProjectApp::InitInstance(void)<br />
{<br />
CProjectDlg dlg;<br />
g_pTheDlg = &dlg;<br />
dlg.DoModal();<br />
}<br />
Maxwell Chen
|
|
|
|
|
Is there a way to move a file to a different folder based on its file extension only? I want to move by the file's extension is because the program I wrote in C++ will create a file with the current date and time as its filename. I was wondering if any C++ functions would do that or any other alternatives.
Thanks in advance!!!
Lynniz
|
|
|
|
|
|
I actually figured out an alternative way. I am using the Gdal Library with C++. Instead of declaring a name for the file at the beginning, I directed the file to the destination folder first and then named it. It might sound little confusing since I am not using straight C++.
I would still like to know if there is a way to move the file by extension only in C++.
Thank you,
Lynniz
|
|
|
|