|
ahahah; nice try.
vote : 1. that's all you need !
TOXCCT >>> GEII power
|
|
|
|
|
I doubt that it is the entire code. IIRC some service pack code was stolen at one time.
Anyway bad choice of question for an open forum!
Ant.
|
|
|
|
|
I wrote a simple win32 application using VC6.0. In the below are my codes. Can you tell me why this program always quit with an error? Thank you for your help!
LRESULT CALLBACK mainWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch (uMsg)
{
case WM_CREATE:
return 0;
case WM_PAINT:
hdc=BeginPaint(hwnd, &ps);
TextOut(hdc, 0, 0, "I love you.", 15);
EndPaint(hwnd, &ps);
return 0;
case WM_SIZE:
return 0;
case WM_CLOSE:
DestroyWindow(hwnd);
return 0;
case WM_DESTROY:
return DefWindowProc(hwnd, uMsg, wParam,lParam);
default:
return DefWindowProc(hwnd, uMsg, wParam,lParam);
}
return 0;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HWND hwndMain;
WNDCLASS wndClass;
MSG message;
hinstance=hInstance;
int nRet;
if(hinstance)
{
wndClass.style=0;
wndClass.lpszClassName="MainWindow";
wndClass.lpszMenuName="MainMenu";
wndClass.lpfnWndProc=mainWndProc;
wndClass.hInstance=hinstance;
wndClass.hCursor=LoadCursor(NULL, IDC_ARROW);
wndClass.hIcon=LoadIconhinstance,
"icon1.ico");
wndClass.hbrBackground= (HBRUSH)GetStockObject(WHITE_BRUSH);
wndClass.cbClsExtra=0;
wndClass.cbWndExtra=0;
}
RegisterClass(&wndClass);
hwndMain=CreateWindow( "MainWindow", "Test main",
WS_OVERLAPPEDWINDOW | WS_HSCROLL |
WS_VSCROLL, // vertical scroll bar
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
(HWND)NULL,
(HMENU)NULL,
hInstance,
NULL);
if(!hwndMain) return false;
ShowWindow(hwndMain, SW_SHOWDEFAULT);
UpdateWindow(hwndMain);
do
{
nRet=GetMessage( &message, hwndMain, 0, 0 );
if(!nRet)
{
break;
}
if(nRet==-1)
{
//log the error
return 0;
}
else
{
TranslateMessage(&message);
DispatchMessage(&message);
}
}
while(1);
return message.wParam;
}
|
|
|
|
|
Just fix:
<br />
LRESULT CALLBACK mainWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
HDC hdc;<br />
PAINTSTRUCT ps;<br />
switch (uMsg) <br />
{ <br />
case WM_CREATE: <br />
return 0; <br />
case WM_PAINT: <br />
hdc=BeginPaint(hwnd, &ps);<br />
TextOut(hdc, 0, 0, "I love you.", 15);<br />
EndPaint(hwnd, &ps);<br />
return 0; <br />
case WM_SIZE: <br />
return 0; <br />
case WM_DESTROY:
PostQuitMessage(0);<br />
return 0 ;<br />
}<br />
return DefWindowProc (hwnd, message, wParam, lParam) ;<br />
}<br />
|
|
|
|
|
Hi,
I am a newbee to programming using c/c++. I want to find out total memory occupied by a linked list in the memory. What is the easiest way to find it out.
|
|
|
|
|
I am not sure, but... how do you think:
std::list<T> foo;<br />
foo.size() * sizeof(T) + sizeof(foo);
Maxwell Chen
|
|
|
|
|
what sort of list ? list<> ?
or a simple array ?
for an array, you should have a trailing NULL at the end, to get the size (unless you already know the size you allocated).
for a list<> you get the nember of elements in the list that you multiply this by the size of an element, plus the size of the list object itself.
TOXCCT >>> GEII power
|
|
|
|
|
(1)list constructed ,what is its elements type? ie:list<int> ,list<string>,list<char> ..
(@) if list<int>,by sizeof(int) ,i can know the byte occupied by the type in your computer,then setting a varible , by iterator i can know the elements numbers in list.by this ,i can know the list occupied the byte number in member
but if list<string>,the case will be a little trouble,you need check out the words numbers in every string,the left solving way are similar the above
|
|
|
|
|
I want to develop a tool which is similar with test automation tool. This tool launches a cmd window and writes some command lines in that window. Now I am able to get cmd window handle, but I don't know how to write the lines. Could anyone help me and I will appreciate it. Here is the code I have done.
WinExec("cmd.exe", SW_SHOW);
CWnd* pDeskWnd = CWnd::GetDesktopWindow();
CWnd* pPrevWnd = pDeskWnd->GetWindow(GW_CHILD);
while (pPrevWnd)
{
CString s;
pPrevWnd->GetWindowText(s);
if (s.CompareNoCase("C:\\WINDOWS\\System32\\cmd.exe") == 0)
{
if (pPrevWnd->IsIconic())
pPrevWnd->ShowWindow(SW_RESTORE);
pPrevWnd->SetForegroundWindow();
pPrevWnd->GetLastActivePopup()->SetForegroundWindow();
CWnd* pCmd = pPrevWnd->GetActiveWindow();
// CPoint id = pPrevWnd->GetActiveWindow();// GetDlgCtrlID();
// pPrevWnd->SetDlgItemText(id, "A command");
/* CDC* pDC = pPrevWnd->GetDC();
pDC->TextOut(0, 100, "A command I want to issue ");*/
return;
}
pPrevWnd = pPrevWnd->GetWindow(GW_HWNDNEXT);
}
|
|
|
|
|
|
But the cmd.exe window is not listening.
|
|
|
|
|
|
I have modified MFCs CFileDialog so that there is a bitmap behind all controls. Now I need to disable AutoComplete functionality from edit control. can anyone help me with this?
|
|
|
|
|
I'm just starting to do some socket programming (non-MFC) and had a couple questions. Is there a ReadLine function to read a single line from a socket? If not would a line be terminated by a \r \n or both? Lastly is there a function to "peek" at the data waiting to be read? Like the peekmessage that would allow me to retreive the the waiting data without actually removing it from the socket?
Thanks.
- Aaron
|
|
|
|
|
use the recv function to read from the socket.
the recv function can be blocking or non-blocking
according to the connection specified...
these sockets are known as synchronous sockets
but, if u wish to get a notification whenever a message reaches the port , then use asynchronous sockets.
there are various options: FD_READ|FD_WRITE|FD_CLOSE|FD_CONNECT
, etc etc...
u have to use the API: WSAAsyncSelect....
search for the API in MSDN and include the required library and header file..
i think the library is : Ws2_32.lib
and header file is winsock2.h , i think winsock.h will also work...
u have to create a user defined message:
#define MY_MSG WM_USER + 100 OR something.... as u wish...
this is one of the arguments in the API call....
we can achieve this also using synchronous sockets , but asynchronous is much more easy....
|
|
|
|
|
monrobot13 wrote:
Is there a ReadLine function to read a single line from a socket?
To my knowledge, sockets do not know what "lines" are. That is a notion understood by us, and some text editors.
monrobot13 wrote:
Lastly is there a function to "peek" at the data waiting to be read?
ioctlsocket(..., FIONREAD, ...); is but one way.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Has anyone here used c-tree plus by FairCom in a real application. I'm especially interested if you did any performance and ease of coding/maintenance comparisons with MSDE.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I did, albeit some time ago, and it predated the availability of MSDE, so I can't give any comparisons. However, I do recall it being as fast as, say C-ISAM from Informix, in the tests I ran. That said, both of them were lower level (ie non-SQL) than MSDE, which meant writing test harnesses for stuff rather than just using Query Analyser to make sure I'd get what I want.
FWIW, my advice would be to avoid anything there isn't an ODBC or OLE DB driver for on a Windows platform - that way you can use tools like MS Query and Crystal Reports, which can save lots of time in the development cycle. However, if you have real performance constraints, and no need for high level access (you can do your own query plans etc), then an ISAM type package can make a real difference (although I'd look at D-ISAM as well).
Steve S
|
|
|
|
|
Joe Woodbury wrote:
Has anyone here used c-tree plus by FairCom...
Not since 1991.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
i am trying to send a mail to abc@spymac.com using SMTP thourgh TELNET..
these are the procedure i used :
1: connected to port 25(SMTP) of spymac.com:
telnet spymac.com 25
2: HELO spymac.com: it return 250 OK.
3: MAIL FROM: deepgeorge@spymac.com:
it returned 250 OK.
4: RCPT TO: deepgeorge@spymac.com:
it returned 554 relay access denied...
i've been searching for the solution for many days now, but in vain..
can anyone help me....
yours truly,
|
|
|
|
|
The clue is in the error message 'relay access denied'.
Spymac isn't running an open relay (a good thing, as it's a spammer's paradise otherwise). Presumably the server has a list of acceptable TCP/IP addresses (or netmasks) it will accept mail from, and your machine isn't on that list.
Alternatively, I'm talking from an orifice not normally reserved for communication, and someone who knows more will be along in a minute.
Steve S
|
|
|
|
|
The IP for spymac.com is 213.218.8.109 the 'MX' for spymac.com is mail-in1.spymac.net which has an IP of 213.218.8.221.
So when you connect to a mail server at spymac.com and ask it to deliver mail to a spymac.com address it must relay that mail to the mail-in1 server, and it won't do that from just any old IP address. Hence the SMTP error.
Try connecting to the other SMTP and see what happens.
BTW your SMTP conversation should start with a 'HELO' or 'EHLO'.
Paul
|
|
|
|
|
hi:below little program ,to realize transfer capital character into lower character。
#include <locale>
#include <iostream>
using namespace std;
int main( )
{
locale loc1 ( "German_Germany" );
char string[] = "HELLO, MY NAME IS John!";
use_facet<ctype<char> > ( loc1 ).tolower
( &string[0], &string[strlen(&string[0])-1] );
cout << "The lowercase string is: " << string << endl;
}
but when running,note error:(1)error C2780: 'const _F &__cdecl std::use_facet(const class std::locale &,const _F *,bool)' : expects 3 arguments - 1 provided
error(2)error C2228: left of '.tolower' must have class/struct/union type
how to modify?
|
|
|
|
|
Dear Friends,
Please let me know how to access USB data. Not only USB what are the methods in VC++ to access USB or RS232 port and system hardware.
Please help me and give me ur valuable suggession ASAP.
Thanking you in advance.
Bilar
|
|
|
|
|
Hello,
I have created a Win32 Windows application that uses a WinMain() and WndProc(). Currently, my application runs within the application Window. I want to see the output of variables, but not inside my application window. Instead, I want to use the console window. Basically, I want to run my application and then if the programs debug flag is on then I want to open up a console window and start printing variables. How do I do this, because if I choose a console application there is no WinMain?
In addition, how do I call an .exe from within my Win32 windows program. Like the cmd.exe and then another custom.exe within that console window? I do not wish to use MFC at this time.
Thanks.
|
|
|
|
|