|
By using EnableWindow(FALSE) , you will get a box with dark gray text on a light gray background. By using SetReadOnly(TRUE) , you will get a box with black text on a light gray background. If you really want to use EnableWindow(FALSE) , you will need to override the OnCtlColor() method in the dialog. When pWnd 's control id is that of the edit control, call SetTextColor(RGB(0, 0, 0)) . Examples of this are on MSDN.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Hi all, I'm using CRecordSet for the database.
here how I open CRecordSet
<br />
CString qstr = "Select * from table1 where age=15";<br />
CDataBase db;<br />
BOOL bSuccess = db.Open(dsnName, FALSE, TRUE, TEXT("ODBC;"),FALSE);<br />
CRecordSet rs(&db);<br />
rs.Open(CRecordset::dynaset,qstr);<br />
So i have no problem getting all the data from the record. but when I want to update the table,
<br />
qstr = "Update table1 set age=12 where name='" + name + "'";<br />
rs.m_pDatabase->ExecuteSQL(qstr);<br />
I did the same thing in different program and it was working greate
but in this program.. I can't find the reason why I'm getting the following error.
<br />
"Operation must use an updateable query"<br />
If anyone of you had the same kind of situation please help me.
Thank you.
|
|
|
|
|
pnpfriend wrote:
can't find the reason why I'm getting the following error.
It's not an error. It's behaving exactly as expected when the database has been opened in read-only mode.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hello david, thanks for your respond.
what making the database opened in read-only mode?
"dynaset" isn't read only mode right?
|
|
|
|
|
Check your code again. While the recordset was opened as updateable, the database itself wasn't.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thank you.. I didn't notice that.
the problem is solved and mission's completed.
Thank you for your help.
|
|
|
|
|
I have a "fileserver" which reads files requested by a client and delivers the data to the client via a socket. I want multiple clients to be able to use the server. I did:
while(true)
{
SOCKET new_socket_fd;
client_len = sizeof (struct sockaddr_in);
new_socket_fd = accept (socket_fd,
NULL,
&client_len);
LPVOID client = (LPVOID)&new_socket_fd;
AfxBeginThread(ServerThread,client);
}
}
THe thread talks back and forth with the client. I now run two instances of an application, each requesting a different set of files. Two threads get started, and then things are unpredictable. Sometimes one runs and one freezes, or both freeze. The threads I thought are using two different sockets so I dont understand what the problem is. Each client has its own socket.
In the thread I do stuff like:
bytes_read = recv(client, (char*)&net_req, sizeof(unsigned int), 0);
rc = send (client, (char *) &sent_size, sizeof (unsigned int), 0);
What is happening in this scenario?
Thanks,
sb
|
|
|
|
|
Maybe one of the operations, read, or send is BLOCKING(Waiting for something.) The "freeze" you mention may really be a BLOCKING action. Test for this with the debugger and make sure you return from each call to send and receive.
I hope this gives you some ideas.
Jerry
|
|
|
|
|
Is this a release or debug problem or both?
I have had some strange deadlocks while using TRACE in multiple winsock threads. Just commenting out the TRACE statements enabled the application to run perfectly. This is DEBUG only as you can expect.
However this may not be your problem. When the application deadlocks, have you tried breaking into the code to see where it is within each thread? This normally gives you some idea of what thread it waiting for what. You ought to be able to find what functions are being called at the very least.
Hope this helps
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Thanks. I will try that.
sb
|
|
|
|
|
Hi,
I have some problem regarding the reading of event from the system Event Log. I am programming in VC++ and wanted to know how to read the event description. The Windows API call ReadEventLog takes EVENTLOGRECORD as the parameter which does not have any field which returns event description. Can anybody please suggest me on this.
Any code snippets or examples would be useful.
Thanks
Abhishek.
|
|
|
|
|
What about the example that accompanies the ReadEventLog() documentation?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The example given in the MSDN documentation does not explain/mention about how to read the description part of an event. I could not find out how to read the description part of an event. Any example or code snippet for reading the description of an event log entry would be beneficial.
Thanks,
Abhishek.
|
|
|
|
|
You need to use the EventID and SourceName members of the EVENTLOGRECORD structure to locate the file containg the description strings.
As a side exercise, you may want to scan the HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application registry key for the EventMessageFile value. This value indicates the name of the file containing the various descriptions you see in Event Viewer.
Lastly, take a look at this article, especially the ShowEventData() function.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Is there some reason you recommnded the registry ControlSet001 instead of CurrentControlSet?
Just curious...
|
|
|
|
|
No reason other than it was the first key I came to that had the EventMessageFile value.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi:
I have tried to insert 600 columns in the list control each of width of 70 ,only about 409 columns headers appear in the list ? any suggestions..
|
|
|
|
|
I would sure hate to have to navigate that many columns. Anyway, perhaps a grid control is more up to the task.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Is there anyone that know how to save the web page that shown in a web browser control to HTML File?
G Nagendran
|
|
|
|
|
VARIANT vtEmpty;<br />
vtEmpty.vt = VT_EMPTY;<br />
m_WebBrowserCtrl.ExecWB(OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER,&vtEmpty,&vtEmpty);
|
|
|
|
|
Thank you very much... It's working...
G Nagendran
|
|
|
|
|
This program will put the menu on the screen but
it won't print the results to the screen.
/* Currency equivalence to the Dollar*/
#include <stdio.h>
float Australian_Dollar; //Australian Dollar
float Euro; //Euro Dollar
float British_Pound; //British_Pound Dollar
float Japanese_Yen; //Japanese_Yen Dollar
float Swiss_Franc; //Swiss_Franc Dollar
/* Dollar conversion */
int main(void)
{
/* 13 */
int menunum; /*Defines the menunum as an integer for the scanf */
float count;
while (menunum != 0) {
printf (" Select a currency by entering a the number beside the currency. \n\n");
printf(" Enter q to quit.\n\n");
printf (" 1. Australian Dollar \n");
printf (" 2. Euro \n");
printf (" 3. British Pound \n");
printf (" 4. Japanese Yen \n");
printf (" 5. Swiss Franc \n"); /* 28 */
scanf("%f", &menunum); /* 30 Users enters the number on the menu bar */
if (menunum == 1){
printf("%f\n", Australian_Dollar);
} /* Australian_Dollar */
else if (menunum == 2) {
printf("%f\n", Euro);
}
else if (menunum == 3) {
printf("%f\n", British_Pound);
} /* 41 British_Pound */
else if (menunum == 4) {
printf("%f\n", Japanese_Yen);
} /* Japanese_Yen */
else if (menunum == 5) {
printf("%f\n", Swiss_Franc);
} /* 51 Swiss_Franc */
else {
printf("Choose another or quit.\n");
}
Australian_Dollar = 1.43; // 50 Define Australian dollar
Euro = 0.83; // Define Euro currency
British_Pound = 0.55; // Define British Pound
Japanese_Yen = 110.9; // Define Janpanese Yen
Swiss_Franc = 1.28; // Define Swiss Franc
scanf ( );
return 0;
}
|
|
|
|
|
madref wrote:
scanf("%f", &menunum);
You're mixing float and int here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
HANDLE icmphandle = IcmpCreateFile();
if(icmphandle=INVALID_HANDLE_VALUE )
AfxMessageBox("Error");
char reply[sizeof(icmp_echo_reply)+8];
DWORD dw = IcmpSendEcho(icmphandle,inet_addr(IPAddress),0,0,NULL,reply,sizeof(icmp_echo_reply)+8,1000);
IcmpCloseHandle(icmphandle);
return dw ;
the above mentioned code when executed gives the following error
"The Procedure entry point IcmpcreateFile could not be found in dynamic link library iphlpapi.dll "
|
|
|
|