|
After I choose Win32 new projectI get the options:
Application type:
Windows application - I get a win window popup
Console application - I get a cmd window popup
DLL
Static library
Additional options:
Empty project
Export symbols
Precompiled header
Add common header files for:
ATL
MFC
ShowWindow( GetConsoleWindow(), SW_HIDE ):
now i don't get an error but it just doesn't work:
in Console application - The cmd window popsup
in Windows application - The win window popsup
maybe ther is an option in the proj properties to hide the cmd window?
Moreno
|
|
|
|
|
sir_moreno wrote: Windows application - I get a win window popup
create a fresh Windows application. delete every thing inside the winmain() function. then tell me the result.
sir_moreno wrote: now i don't get an error but it just doesn't work:
when i tested, it worked.
nave
|
|
|
|
|
Ok It worked but it's not in winmain but in:
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
//ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
Thank you all
Moreno
|
|
|
|
|
I have three classes all derived from the same base class. Is it at all possible for one class to call a function in another class? I'm guessing the base class would need to store a pointer to the derived classes, which in my opinion is a little messy. If there is an easier way to do this, please tell. Thanks.
|
|
|
|
|
didn't you ask this question last thursday ?
what's wrong with virtual ?
|
|
|
|
|
Not quite the same question, that was about a callback function in the base class. I tried the virtual method, but it doesn't seem to work. If I leave the definition empty, I get linker errors; If I set an empty method, the code only calls the empty method and not that of the redefined method in the other class.
|
|
|
|
|
hum, i think code sample will talk much than words
can you please show a brief piece of the code you tried, and explain clearly what you can it to do... thx
|
|
|
|
|
Sure, I know my English isn't all that great. Here's a very simplified example
class base
{
virtual DoSomethingElse()
{
}
};
class first : public base
{
void DoSomethingElse()
{
}
}
class second : public base
{
void DoSomething()
{
DoSomethingElse();
}
}
|
|
|
|
|
and then... you forgot the second part of my previous post ^^
what do you intend it to do ?
|
|
|
|
|
Haha. Think of a deck of cards. The base class represents the table where the cards will be used. The derived classes represent various actions with the deck of cards ( shuffling, dealing... ). One of the derived classes inparticular represents all the cards currently visible (face up) on the table. When a card is dicarded, I call a member function of my discards class to add the card to an internal array. I must also add the card to the list of visible cards. But rather than calling two functions, I want to know if I can automate this from the discard class by calling a member function of the visible class directly.
Again, this is simplified, there is a lot more going on in the background which I don't want to expose by creating un-necessary pointers.
|
|
|
|
|
waldermort wrote: Haha. Think of a deck of cards. The base class represents the table where the cards will be used. The derived classes represent various actions with the deck of cards ( shuffling, dealing... ). One of the derived classes inparticular represents all the cards currently visible (face up) on the table. When a card is dicarded, I call a member function of my discards class to add the card to an internal array. I must also add the card to the list of visible cards. But rather than calling two functions, I want to know if I can automate this from the discard class by calling a member function of the visible class directly.
If this is what you are trying to do, it sounds like you have a design flaw problem. Inheritence (public inheritance anyway) should follow an "is-a" relationship. What you are trying to do would be better suited for 2 collections (a collection of visible cards, and a collection of non-visible ones) with a manager to maintain the both. A class derived from the Deck of cards is not a good design for this problem.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Is there some problem in declaring a pointer to the first class in the second one:
ex :
class second : public base
{
void DoSomething()
{
first *pFirst=new first();
pFirst->DoSomethingElse();
DoSomethingElse();
}
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: Is there some problem in declaring a pointer to the first class in the second one:
Yes because then I would have to pass the pointer into the class. Creating a new instance of the object will only lead to problems. But you did give me an idea, static !
Declaring the function and a few members as static has solved the problem.
|
|
|
|
|
waldermort wrote: Is it at all possible for one class to call a function in another class?
Sure, if those methods (in the other class) are static.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Can u plz help me to rectify the error.
1)If i write the code as shown below I am getting the correct results
SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName='tejaswini'";
2)If I write the code as shown below I am getting an error saying that error in execution.
What is the wrong with my code?
CStirng Str="tejaswini";
SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str";
Plz help me.
Thanks in advance;
|
|
|
|
|
tejaswini.g wrote: CStirng Str="tejaswini";
SQLCHAR SQL[] = "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str";
CString Str;
Str.Format( _T( "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=%s" ), _T( "tejaswini" ));
SQLCHAR SQL[] = Str;
|
|
|
|
|
tejaswini.g wrote: What is the wrong with my code?
tejaswini.g wrote: "SELECT EmployeeID,Salary FROM EMPLOYEE WHERE EmpName=Str";
because the SQL engine is executing such query, as is. it is then searching Str as the Employee name...
|
|
|
|
|
Si Str va en el texto entrecomillado el ordenador lo interpreta como texto y no como tu variable.
Desconozco como funciona un SQLCHAR, si el texto fuera un CString deberías ponerlo así...
"SELECT EmployeeID, Salary FROM EMPLOYEE WHERE EmpName='" + Str + "´";
En este caso si cambiará Str por el valor de tu variable, además recuerda que en la sentencia Where EmpName= algo, ese algo tiene que ir entre comillas simples.
Espero haberte ayudado.
|
|
|
|
|
Hablamos inglés aquì señor...
|
|
|
|
|
nave
|
|
|
|
|
i told him that we were speaking english here !
|
|
|
|
|
toxcct wrote: i told him that we were speaking english here !
Quite obviously.
|
|
|
|
|
but which language was that?
nave
|
|
|
|
|
spanish buddy
|
|
|
|
|
gracias
nave
|
|
|
|