|
No, the other header is included, but depending on what is in the other header it may end up with a bunch of undefined symbols. If you are using MFC for example, all the MFC stuff gets included via the precompiled header. If the other header is included before stdafx.h and it uses MFC with out explicitly including stdafx.h itself it will cause errors.
I hope that was clear enough
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Actually, the compiler ignores everything before the #include "stdafx.h" line. Try it - stick gibberish there and it'll compile just fine (in VC6 at least, I haven't tried it in 7/8).
|
|
|
|
|
Yeah, I just tried it in VC8. Same thing. The compiler completely ignored the gibberish I typed in there. Just when I think I might know what the heck I am talking about I get shown how wrong I am
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello everyone:
I want to connect to mysql in a long-range computer that use unix OS,my OS is windows NT
When i input the order c:/mysql/bin/mysql -h192.168.11.5 -uruitech -p enter ******(the pw),there is a error happen:
ERROR 2003 (HY000):Can't connect to MySQL server on '192.168.11.5'(10060)
I was puzzled,the long-range computer has commision others to access its mysql DB.and it's works well.
I need help~~~
Thanks in advance!!!
Henry
-- modified at 23:39 Sunday 26th November, 2006
|
|
|
|
|
I'm not an expert on MySQL, but based on my experience with SQL Server I would suggest finding out what ports MySQL uses to listen for incoming connections and respond to clients. If these ports are being blocked by a firewall on either the client computer or the server, you won't be able to connect. Try turning off any firewalls (temporarily) and see what happens.
Scott
|
|
|
|
|
Need 2 design a C program to copy a log file from database (Timberline) into a text file and it has to get auto updated as per the log file modifications.
Thnx in advance !!!
|
|
|
|
|
nimmi_friends wrote: Need 2 design a C program to copy a log file from database (Timberline) into a text file
Sounds like fun. Good luck!
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
I wrote a function that open a registry key and than query some values - in fact there were three. Having full rights on it I observed something strange:
- the key opened successfully
- the first value failed to read
- the next two read OK
I tried to change the order of the values, but same result.
Each time the first read failed and returned error 234 -
//
// MessageId: ERROR_MORE_DATA
//
// MessageText:
//
// More data is available.
//
#define ERROR_MORE_DATA 234L // dderror
/* from winerror.h*/
I tried to reread the value after the failed attempt and - surprise - it worked! Why?
And what means the error code obtained first?
|
|
|
|
|
You aren't initializing the parameters properly. Mostly likely, the parameter that indicates the size of the buffer you're providing for the data isn't initialized, or is initialized to 0.
Oh - and i have winerror.h . I don't have your code. Given that the problem is in the latter, it would be a good idea for you to post the relevant portions of that next time, rather than the system header file.
|
|
|
|
|
Thanks!
|
|
|
|
|
The code:
int RegReadLastRun(long *L){
HKEY hk;
DWORD RegType = REG_DWORD, size;
if(RegOpenKey(HKEY_LOCAL_MACHINE, reg0, &hk))return 1;
if(RegQueryValueEx(hk,reg1,NULL,&RegType,(unsigned char*)L,&size))return 2;
if(RegQueryValueEx(hk,reg2,NULL,&RegType,(unsigned char*)(&Inst),&size))return 3;
if(RegQueryValueEx(hk,reg3,NULL,&RegType,(unsigned char*)(&Uninst),&size))return 4;
if(RegCloseKey(hk))return 5;
return 0;}
reg1, 2 and 3 are DWORD
|
|
|
|
|
As i suspected, you're not initializing size . It should be set to sizeof(DWORD) for a type of REG_DWORD .
Get used to reading the docs before blindly calling functions - it'll save you a lot of time and headaches.
|
|
|
|
|
Thanks, buddy!
You see, sometimes when you are on a hurry, you make mistakes!
|
|
|
|
|
OK. Now it works. Thanks a lot!
|
|
|
|
|
Maybe the buffer you provided was not enough big to contain the whole key value, so you had to read twice before getting success...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
The code:
int RegReadLastRun(long *L){
HKEY hk;
DWORD RegType = REG_DWORD, size;
if(RegOpenKey(HKEY_LOCAL_MACHINE, reg0, &hk))return 1;
if(RegQueryValueEx(hk,reg1,NULL,&RegType,(unsigned char*)L,&size))return 2;
if(RegQueryValueEx(hk,reg2,NULL,&RegType,(unsigned char*)(&Inst),&size))return 3;
if(RegQueryValueEx(hk,reg3,NULL,&RegType,(unsigned char*)(&Uninst),&size))return 4;
if(RegCloseKey(hk))return 5;
return 0;}
reg1, 2 and 3 are DWORD
|
|
|
|
|
As stated by MSDN:
LONG RegQueryValueEx(
HKEY hKey,
LPTSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
lpValueName
Pointer to a null-terminated string containing the name of the value to query.
hence reg1 ,reg2 , reg3 have to be strings.
Moreover, MSDN says:
lpcbData
Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the lpData parameter. When the function returns, this variable contains the size of the data copied to lpData.
Hence you have to initialise size , for instance, if
L is defined as follows
long * L = new long[10];
then you have to set:
size = 10 * sizeof(long);
Incidentally last considerations show that your function signature is not correct, since you have to pass the buffer lenght too.
By the way, where come from Inst , Uninst ?
Finally, the code is a bit messy... Maybe if you tell us exactly what you intend to do, we will show a cleaner sample.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
OK. Now it works. Thanks a lot!
|
|
|
|
|
You're welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Read the docs carefully, the registry APIs are tricky. ERROR_MORE_DATA means the buffer you passed in isn't big enough to hold the data.
|
|
|
|
|
The code:
int RegReadLastRun(long *L){
HKEY hk;
DWORD RegType = REG_DWORD, size;
if(RegOpenKey(HKEY_LOCAL_MACHINE, reg0, &hk))return 1;
if(RegQueryValueEx(hk,reg1,NULL,&RegType,(unsigned char*)L,&size))return 2;
if(RegQueryValueEx(hk,reg2,NULL,&RegType,(unsigned char*)(&Inst),&size))return 3;
if(RegQueryValueEx(hk,reg3,NULL,&RegType,(unsigned char*)(&Uninst),&size))return 4;
if(RegCloseKey(hk))return 5;
return 0;}
reg1, 2 and 3 are DWORD
|
|
|
|
|
Hello everyone,
In Visual Studio 2005, I can not create Visual C++ Smart Device project -- when input required inputs (project name, path, etc.) in "New Project" dialog, then when I click OK, the "New Project" displays again -- without any error notifications...
And I have checked the related physical location of the project path, the project is not created.
I am wondering whether it is a bug of Visual Studio 2005, or I need to install some additional components in order to create Visual C++ Smart Device type project?
thanks in advance,
George
|
|
|
|
|
Hi,
I want to read the call stack of another process and save it to a file.
I am able to atach to the process by using DebugActiveProcess but waht is the function which reads the info from the callstack and translates the symbol information
DavidR
|
|
|
|
|
StackWalk64()
It's not quite trivial though - you'll want to read up on the DbgHelp API[^].
Alternately, just call MiniDumpWriteDump() [^], and use a debugger to examine the resulting dump.
|
|
|
|
|
im using a performance counter to monitor my bandwidth but its not displaying like it does in performance monitor in my code it jumps from 0 to a 34523452(positive) number to a -45735399negittive) number in performance monitor it runs steady with what azureus says im uploading at when azureus says upload is around 226 KB/s performance monitor says around 244000 bytes/s here is the code that seems to not be right its running on a 1 sec timer
PDH_FMT_COUNTERVALUE fmtValue;
pdhStatus = PdhCollectQueryData(hQuery);<br />
if (ERROR_SUCCESS != pdhStatus)<br />
{<br />
ErrorExit("PdhCollectQueryData");<br />
cleanup();<br />
}<br />
<br />
pdhStatus = PdhCollectQueryData(hQuery);<br />
<br />
pdhStatus = PdhGetFormattedCounterValue (hCounter,<br />
PDH_FMT_DOUBLE,<br />
&ctrType,<br />
&fmtValue);<br />
<br />
if (pdhStatus == ERROR_SUCCESS)<br />
{<br />
sentinfo.Empty();<br />
sentinfo.Format("%.3d", fmtValue.doubleValue);<br />
GetDlgItem(IDC_SENT)->SetWindowText(sentinfo);<br />
UpdateWindow();<br />
}<br />
else<br />
{<br />
ErrorExit("PdhGetFormattedCounterValue");<br />
cleanup();<br />
}<br />
MSG msg;<br />
if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}
if you see what aint right please let me know.
|
|
|
|
|