|
Yes, this IS a VC++ forum. The odds of you finding an answer here are probably slim, but I'll tell you right away, they won't increase from you asking over & over. You'll just annoy people, and possibly miss out on a reply.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
ChiYung wrote:
but i really need help!!!
If you post your question on the comp.lang.c.moderated newsgroup, you will get an answer to your question. It is the one I frequent when answering Unix questions. If you don't have a news reader you can go to groups.google.com
Hope that helps.
After a poor performance in London in 1899, Steinitz went insane and died a year later on August 12, 1900 at Wards Island, N.Y.
|
|
|
|
|
I thought comp.lang.c.moderated was dead ? I use comp.lang.c++ a bit, but I thought the moderated one was closing down...
comp.lang.c++ are pretty tough on off topic questions if they relate to Windows, but pretty easy on Unix off topic questions in my experience.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Christian Graus wrote:
comp.lang.c++ are pretty tough on off topic questions if they relate to Windows, but pretty easy on Unix off topic questions in my experience.
Are you trying to lead him to trouble? Look at the what the moderators say about questions pertaining to C. http://www.gotw.ca/modguide.htm
After a poor performance in London in 1899, Steinitz went insane and died a year later on August 12, 1900 at Wards Island, N.Y.
|
|
|
|
|
Why are you expecting to see random output? I don't see any randomness-generating functions in your code. Try adding a random delay somewhere and see if that changes the output.
|
|
|
|
|
I'm using Intel's C++ compiler, version 6, as a plug-in compiler in Visual Studio 6, with the latest MS Platform SDK. When I use the Qwp_ipo (multi-file interprocedural optimizations) compiler switch, I get the following error at link time:
IPO: performing multi-file optimizations
Error unresolved : _main
Referenced in libc.lib(crt0.obj)
I do NOT have _ATL_MIN_CRT defined. Additionally, this problem never occurred with the MS compiler or version 5 of Intel's compiler.
If I link dynamically with /MD instead of with /ML, it builds fine, but that requires the end user to have one Intel's math library dll which I can't redistribute under the evaluation license I have.
I don't even know how to start debugging this...
|
|
|
|
|
Anonymous wrote:
If I link dynamically with /MD instead of with /ML, it builds fine, but that requires the end user to have one Intel's math library dll which I can't redistribute under the evaluation license I have.
But you are allowed to distribute a compiled binary??? Methinksnot.
Besides, this is the wrong place for your question. Please contact Intel or try some Intel newsgroups/forums.
|
|
|
|
|
>> But you are allowed to distribute a compiled binary??? Methinksnot.
There is no statement to that effect in the license agreement. Anyway, thanks for the reply.
|
|
|
|
|
When it comes to the "DeviceIoControl (hCD, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &dgCDROM, sizeof(dgCDROM), &dwNotUsed, NULL)" function, the GetLastError returns 1, which is incorrect function, what is that?
code:
HANDLE hCD, hFile;
DWORD dwNotUsed;
hFile = CreateFile ("sector.dat",
GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
hCD = CreateFile ("\\\\.\\D:", GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
if (hCD != INVALID_HANDLE_VALUE)
{
DISK_GEOMETRY dgCDROM;
PREVENT_MEDIA_REMOVAL pmrLockCDROM;
pmrLockCDROM.PreventMediaRemoval = TRUE;
DeviceIoControl (hCD, IOCTL_DISK_MEDIA_REMOVAL,
&pmrLockCDROM, sizeof(pmrLockCDROM), NULL,
0, &dwNotUsed, NULL);
if (DeviceIoControl (hCD, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &dgCDROM, sizeof(dgCDROM), &dwNotUsed, NULL))
{
LPBYTE lpSector;
DWORD dwSize = 2 * dgCDROM.BytesPerSector;
lpSector = (LPBYTE)VirtualAlloc (NULL, dwSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
SetFilePointer (hCD, dgCDROM.BytesPerSector * 16,
NULL, FILE_BEGIN);
if (ReadFile (hCD, lpSector, dwSize, &dwNotUsed, NULL))
WriteFile (hFile, lpSector, dwSize, &dwNotUsed, NULL);
VirtualFree (lpSector, 0, MEM_RELEASE);
}
pmrLockCDROM.PreventMediaRemoval = FALSE;
DeviceIoControl (hCD, IOCTL_DISK_MEDIA_REMOVAL,
&pmrLockCDROM, sizeof(pmrLockCDROM), NULL,
0, &dwNotUsed, NULL);
CloseHandle (hCD);
CloseHandle (hFile);
}
r, true);
// Unlock the disc in the CD-ROM drive.
pmrLockCDROM.PreventMediaRemoval = FALSE;
DeviceIoControl (hCD, IOCTL_DISK_MEDIA_REMOVAL,
&pmrLockCDROM, sizeof(pmrLockCDROM), NULL,
0, &dwNotUsed, NULL);
CloseHandle (hCD);
CloseHandle (hFile);
}
|
|
|
|
|
Isn't it that you can only use IOCTL_DISK_GET_DRIVE_GEOMETRY on a physical device? You only have a handle to the mounted filesystem.
|
|
|
|
|
ok, this is my code:
char *s = (char *)malloc(1024);
DWORD dwBytesRead;
HANDLE hFile;
hFile = CreateFile("\\\\.\\D:", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
ReadFile(hFile, s, 1024, &dwBytesRead, NULL);
CloseHandle(hFile);
free(s);
D is my CD drive, but when i do this, the ReadFile function returns 1 indicating the operation went succesful. bu the dwBytesRead is 0 and the buffer hasn't been filled. however if i change the "\\\\.\\D:" to ("\\\\.\\C:", then it works fine, anyone know what's wrong?
thanks in advance
|
|
|
|
|
I don't have the answer to your question but I don't think you want FILE_SHARE_WRITE on a read-only device.
|
|
|
|
|
I know, but it can't hurt, can it?
|
|
|
|
|
sonork: 100:18407
You yard yellow years yieldingly; you yanked your yearning yoke.
-Jeremy Falcon
|
|
|
|
|
Here's some code to help you out.
void CCDReadDlg::ReadCD()
{
DWORD dwSize = 2048;
DWORD dwBytesRead;
LPBYTE lpBuffer;
HANDLE hFile;
hFile = CreateFile("\\\\.\\F:", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
lpBuffer =(unsigned char*) VirtualAlloc (NULL, dwSize,
MEM_COMMIT|MEM_RESERVE,
PAGE_READWRITE);
//In CDFS(i.e.ISO9660 format) sector size is 2048.
//the first 16 sectors are always filled with 0's
//To get something meaningful first skip to 16th sector and then read
//course the propah way is to first use DeviceIoControl calls
//to lock the media and finally unlock it after reading... .
SetFilePointer (hFile, dwSize*16,
NULL, FILE_BEGIN);
if (ReadFile (hFile, lpBuffer, dwSize, &dwBytesRead, NULL))
{
//you buffer should have a volume descriptor
//to begin with
//do something
}
VirtualFree (lpBuffer, 0, MEM_RELEASE);
}
CloseHandle(hFile);
}
sonork: 100:18407
You yard yellow years yieldingly; you yanked your yearning yoke.
-Jeremy Falcon
|
|
|
|
|
dwBytesRead is 0 and lpBuffer is empty. But the ReadFile function returns 1 so there shouldn't be anything wrong... strange
|
|
|
|
|
dwBytesRead is 2048 for me(with media present in CDROM ofcourse) i.e. 1 sector(just what I want) and lpBuffer contains the CDROM volume description as expected.
You yard yellow years yieldingly; you yanked your yearning yoke.-Jeremy Falcon-CPite.
Amit Dey
sonork: 100:18407
msn: visualcdev
|
|
|
|
|
Is your CDROM drive setup correctly? Do you have any other cdfs drivers like Adaptec DirectCD on your system? course, you are trying this code on Win2K/NT...right?
hmmm....
You yard yellow years yieldingly; you yanked your yearning yoke.-Jeremy Falcon-CPite.
Amit Dey
sonork: 100:18407
msn: visualcdev
|
|
|
|
|
HI
i want to have a toolbar on desktop, but CreateToolbarEx()
needs a window handle as a parent. I have passed the desktop handle by calling GetDesktopWindow but it doesn't work. Is there any solution to the problem.
|
|
|
|
|
You'd want to use an appbar. Please lookup codeproject for an article and code on appbars.
sonork: 100:18407
You yard yellow years yieldingly; you yanked your yearning yoke.
-Jeremy Falcon
|
|
|
|
|
I made a Visual C++ application that uses ADO to query a database, and to update the changes.
I send some simple SQL statement to the database (an Access DB until now), like SELECT, UPDATE, etc.
Now I would like to make this through the internet.
I mean I run my program on my computer and it query the database that instead is on another computer, and it connects to it via tha Internet.
Where I can find a guide on how to do it?
Thankyou.
P.S.
I also think that I will need to use SQL Server or Oracle to store my database remotely, ad than use this server. Are there any service that offers this kind of hosting for free, so that I can start experimenting, without the hassle of installing my own SQL Server or ORACLE ?
Thank you very much.
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
You can do this any number of ways.
Here is how we currently do it at work:
Create an XML file on the client describing the data.
Send the XML to an ASP page which then passes it on to a COM object.
The COM object parses the entire XML and adds the data to the db.
You could also use an ISAPI DLL to parse the data.
(BTW, you need to have IIS running on the computer you are sending to.)
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
If i have a function that uses a for loop that does very much and the action could take up to 5 minutes. How do i, if i have a cancel button on the form, make that cancel button usable? Cause i can't use it while the for loop is running. I saw something in the faq about multithreading but i don't know how to use it.
Thanks in advance.
|
|
|
|
|
I think this will work:
void Yield()
{
MSG msg;
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
for ...
{
Yield();
}
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
Thankyou, works perfectly.
|
|
|
|
|