|
hey guys
i've recently started a nex project and this time i want to make things more fancier; i'm going to output the program in a windows window
i've written the code for creating such a window, but i have one error and i don't seem to be able to sort it out
The error is:
Error E2040 bcc11.cpp 5: decleration terminated incorrectly
can anyone help?
(i'm using borland c++ compiler 5.5 btw)
here's the code:
<br />
#include <windows.h><br />
int WINAPI WinMain(HINSTANCE instance, HINSTANCE previousInstance, LPSTR commandLine, int show);<br />
int main();<br />
{ LRESULT CALLBACK WindowProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam)<br />
return DefWindowProc(windowHandle, message, wParam, lParam);<br />
WNDCLASS myWindowClass<br />
{<br />
myWindowClass.hbrBackground = (HBRUSH) GetStockObject(TRANSPARENT_BRUSH);<br />
myWindowClass.hCursor = LoadCursor(NULL, IDC_ARROW);<br />
myWindowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);<br />
myWindowClass.hInstance = instance;<br />
myWindowClass.lpfnWndProc = WindowProc;<br />
myWindowClass.lpszClassName = "StandardWindowClass";<br />
myWindowClass.style = CS_VREDRAW | CS_HREDRAW;<br />
myWindowClass.style = CS_VREDRAW | CS_HREDRAW;<br />
myWindowClass.cbClsExtra = 0;<br />
myWindowClass.cbWndExtra = 0;<br />
RegisterClass(&myWindowClass);<br />
}<br />
<br />
HWND myWindowHandle = CreateWindow(<br />
"StandardWindowClass",
"Test bcc11",
WS_OVERLAPPED | WS_VISIBLE | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
0, 0,
instance,
0);
<br />
MSG msg;<br />
<br />
do<br />
{<br />
if (PeekMessage(&msg, myWindowHandle, 0, 0, PM_REMOVE))<br />
{<br />
TranslateMessage(&msg);<br />
<br />
DispatchMessage(&msg);<br />
<br />
}<br />
} while (true);<br />
{<br />
switch (message)<br />
{<br />
case WM_CLOSE:<br />
{<br />
PostQuitMessage(0);<br />
<br />
return 0;<br />
}<br />
}<br />
<br />
return DefWindowProc(windowHandle, message, wParam, lParam);<br />
} <br />
while (msg.message != WM_QUIT);<br />
}<br />
Thanks alot!
Peter
|
|
|
|
|
the include should be #include <windows.h>
sorry for the double post!
|
|
|
|
|
what the hell?!
why isn't this thing showing my included file?!?!?!
it's the windows.h file that should be inculded windows . h
for some reason < windows . h > isn't shown...
sorry for the triple post but i don't know why it doesn't show that filename...
|
|
|
|
|
Peter Charlesworth wrote: for some reason < windows . h > isn't shown...
You need to click the < and > buttons above the smileys.
Peter Charlesworth wrote: sorry for the triple post...
Just modify the one until you get it right. Preview helps in this endeavor.
Also, use <pre> tags instead of <code> tags so that your indention is preserved.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Yes, you're right, david
I'll do just that next time
Still, my problem remains
can anyone help?
|
|
|
|
|
|
Is there a way to insert a item into a list control with the LVIS_STATEIMAGEMASK already set to "checked"?
I am trying to catch a LVIS_STATEIMAGEMASK change in OnLvnItemchanged and I don't want to catch the initial population of the list.
Right now I insert the item into the list control then SetCheck(0) that causes me to catch the LVIS_STATEIMAGEMASK change when the list is first populated.
Any Ideas?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
RobJones wrote: I am trying to catch a LVIS_STATEIMAGEMASK change in OnLvnItemchanged and I don't want to catch the initial population of the list.
One way around this is to set a flag variable to true before populating the list, and then set it to false after populating the list. Then in the OnLvnItemchanged() method, don't do anything if the flag variable is equal to true. Make sense?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Yeah I'll have to set it up that way... I guess I was just wondering if it was possible to set the lvi to a checked state before inserting it into the control. Guess not.
Thanks for your help!
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
An edit box is being used for displaying the status of loop iterations. It uses the following approach:
ebptr->SetWindowText(s);
UpdateWindow(FALSE);
How can one get the updated edit box text to display before continuing?
Thanks in advance.
-jon
|
|
|
|
|
Even though a WM_PAINT message was sent to the window's queue, it won't get processed because the loop is not yielding control of the CPU.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Use RedrawWindow() specifing the RDW_UPDATENOW flag to force a WM_PAINT message to be sent to the window.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
|
Hi ,
I am having problem when I assign a string more than 255 characters to a CRecordset memeber like
(m_Result is a CString)
Res->m_Result=str1; (str1 is more than 255 characters)
UpDate();
and I get a exception "Debug Assertion Failed , DBFRX line 287 ".
Is there any other way of setting string more than 255 characters using CRecordset->Update() ???
Thanks,
ZINC
|
|
|
|
|
What type/size of field in your table is m_Result tied to?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
its a ACCESS table and field is of ntext type
|
|
|
|
|
zinc_z wrote: ...and field is of ntext type
Not sure how 'ntext' compares to 'text' but how large is the field?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
|
You have already indicated that m_Result is a CString object. My question was about the field in the database.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
m_Result is bound to of ntext(length 16) type field in SQL Server . I have tried to change the field to varchar (length 700) but no diff. I still got the same exception.
any other sugestions ?
Regards,
ZINC
|
|
|
|
|
When i enter the words rents and will the program will say "will is larger than rents" which is wrong. I can't figure out why it's doing that. I supplied the code below (might have forgot little things like ; or ,). If anyone can tell me what is wrong it would help me a lot. I'm new to C++ programming.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a, b;
cout << "Enter two words." << endl;
cin >> a >> b;
cin.ignore(10,'\n');
string small, big;
if (a < b)
{
small = a;
big = b;
}
if (a > b)
{
small = b;
big = a;
}
if (a.size() == b.size() && a != b))
{
cout << "Same size, but different string" << endl;
cin.get();
return 0;
}
if (a == b)
{
cout << "Their the same string" << endl;
cin.get();
return 0;
}
cout << big << " is larger than " << small << endl;
cin.get();
return 0;
}
-- modified at 13:53 Friday 10th February, 2006
|
|
|
|
|
will is larger than rents ...
the < or > compare lexicographically; so W is bigger than R.
anyway, in my case, my will will be bigger than my rent ... :->
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Would <= and >= fix the problem? If not what would I have to put there?
|
|
|
|
|
if(a.size() > b.size())
{
....
}
if(a.size() < b.size())
{
....
}
if you are compairing the lengths.
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
no it will not.
R is still smaller ( or equal ) than W, whatever the length of the rest of the strings.
what are you trying to compare ? the string length ? or the lexical order ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|