|
IsBadReadPtr() and IsBadWritePtr() don't work and can actually cause more problems. See this blog[^] for more
|
|
|
|
|
Sorry about that. I didn't know the internal mechanics of these two APIs, nor that their usage can lead to such disasters.
Then I suppose remains HeapWalk... or also this one contains a hidden treasure as well?
|
|
|
|
|
Thanks a lot for the great help from you all!!
Thanks & Regards,
Suman
|
|
|
|
|
now i want to get some informations about the local Floppy Driver. the information may content Vendor ID, Product ID ... or some thing else~
can anybody give me some hint?
if C/C++ can do this tell me how, if not give me some explaination.
thanks ~~~
|
|
|
|
|
CreateFile to open the floppy device;
DeviceIoControl with codes of choice; may include:
- IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER
- IOCTL_STORAGE_GET_MEDIA_TYPES(EX)
etc.
|
|
|
|
|
i got the answer in the Hardware board...
For a floppy drive? There isn't a way to do this. The Device Manager in Windows doesn't care. As far as I know, most of them come back as a Generic Drive on a Standard Controller. About the only ones that would come back with any information are the old 120MB Super Drives.
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 20:19 Tuesday 26th December, 2006
|
|
|
|
|
Dear All,
Dear Mr.Asef (Iran)
I need to control a peripheral device via parallel port (LPT) by programming Visual C++ language but I'm still confused how to do it.
I have down loaded the program written by Mr. Asef (Port Access
By asef.)but it doesn't work properly , I think that may be I have miss something...
Would you please help me and give me your instruction to solve this problem!
my email: bangkokhanoi2007@yahoo.com
Thank you in advance!
Your sincelery,
BK2007
|
|
|
|
|
Check following before you could do any thing :
1. Bios setting in your PC is in EPP/ ECP mode. (SPP is uni directional)
2. You BIDIR bit is set in base+1 port. (MSB of port 3F9 if Parallel port address is 3F8 and so on...);
I think its a pretty easy task.
I dont know whether Iam allowed to provide url links in this message board.
therefore ... no risk...
haribabu
|
|
|
|
|
Hi all.
I have two threads ... one as a sender and the other a receiver for data sent over sockets. But the sockets are being created and handled in a dll ( a VC# dll which has a class named Class1). so when I call these threads I have to pass the object of the class in the dll because the sender and receiver use the same sockets right!!.
Here is what I have in the sender and receiver threads... ( and I dont know a work around for the DoEvents thing, because I have to enforce the processor to do other tasks while the thread is in a while loop .... and I have removed the doevents completely as well and it doesnt make any difference. So the problem is not with doevents).
DWORD WINAPI SenderThread(LPVOID iValue)
{
Mutex^ mut = gcnew Mutex();
mut->WaitOne();
Class1^ senderdll = *((Class1^*)iValue);
mut->Close();
int returnval;
DoEvents();
while(true)
{
returnval = senderdll->SenderEntryPoint();
if(returnval == 1) // sockets closed
{
break;
//dynamic_cast<autoresetevent^>(stateInfo)->Set();
}
}
return 0;
}
DWORD WINAPI ReceiverThread(LPVOID iValue)
{
Mutex^ mut = gcnew Mutex();
mut->WaitOne();
Class1^ receiverdll = *((Class1^*)iValue);
mut->Close ();
int returnval;
DoEvents();
while(true)
{
returnval = receiverdll->ReceiverEntryPoint();
if(returnval == 1) // the sockets closed
break;
}
return 0;
}
and here is how I am creating these threads. (The cmdListen_Click function creates the sockets.)
Class1^ c = gcnew Class1();
c->cmdListen_Click(NewPosition);//call the dll function to create sockets
////Threads start
DWORD dwGenericThread;
hThread2 = CreateThread(NULL,0,SenderThread,&c,0,&dwGenericThread);//the sender thread
if(hThread2 == NULL)
{
DWORD dwError = GetLastError();
return 0;
}
hThread3 = CreateThread(NULL,0,ReceiverThread,&c,0,&dwGenericThread);//the receiver thread
if(hThread3 == NULL)
{
DWORD dwError = GetLastError();
return 0;
}
//////Threads end
Now the two problems I am facing are:
1) How do I synchronize the threads? The AutoResetEvent (as given in http://msdn2.microsoft.com/en-us/library/system.threading.autoresetevent.aspx), uses a threadpool to create threads. My problem is if I use the threadpool instead of using the CreateThread how do I pass the Class1 object in the threads ?
2) My second problem is the AccessViolation error, which I am getting at the point where I create the instance of the Class in the thread. ( in both sender or receiver, depending upon which thread I am creating first !!).
Class1^ receiverdll = *((Class1^*)iValue);
What am I doing wrong here? When I was getting an access violation error in VC#, I used LOCK to enforce resource allocation. How do I do this in VC++?
Thanks.
|
|
|
|
|
Try posting your C++/CLI questions here[^]
|
|
|
|
|
Does anybody know which string would expand to "C:\Windows\Profiles\<username>\ ", I believe this path exists on Win98 & ME.
Or better still, does anybody know of a reference list for these strings? MSDN has come up a little short on this api
|
|
|
|
|
That would be %USERPROFILE%
|
|
|
|
|
Thanks for that. It expands to something different on Vista, and since I don't have access to a 98 machine, it's better to ask :p
|
|
|
|
|
|
Invisible window? Don't create a console app, instead create a windows app and don't show the window.
|
|
|
|
|
|
is there any way to change it in the registry? or any way to change it without hacking explorer.exe?
|
|
|
|
|
of course on the codeproject you can see an example of Start Button I'm not its helpful for you but see it
|
|
|
|
|
Hello all this is my first post here,
just a quick question, how do I create a program using vstudio2005, and be able to run
in on other windows machine.
thank you
|
|
|
|
|
The biggest reason programs won't run on previous versions is because the programer chooses functions that are not supported. When making your program, refer to MSDN for the api calls, MSDN lists the minimum version of windows required.
|
|
|
|
|
Hi WalderMort,
The only difference between the two system is that the other one does not have
visual studio 2005, so I was just wondering if this is/are one of the reason the exe I created does not run,
the exe was from a beginners tutorial from this site.
thank you
ennm4
|
|
|
|
|
What error are you getting? It sounds as though the exe is looking for a dll that may not be on your other PC.
|
|
|
|
|
Well , when I run the exe file , I got the following msg
"The application failed to start because incorrect configuration. Reinstalling may fix it"
I created the exe , by using the build option on the visual studio 2005 ide, this is the correct way right?
thanks again
ennma
|
|
|
|
|
I see, By default VS2005 adds a manifest file to the exe, this file will prevent the exe from running unless specific dlls are in a specific directory. Try excluding the manifest from your app, or add the required dll's, in the correct directory ( sorry I can't remember which ).
|
|
|
|
|
WalderMort wrote: By default VS2005 adds a manifest file to the exe, this file will prevent the exe from running unless specific dlls are in a specific directory.
No, it’s because VS2005 targets the latest C Run time. It is no longer a matter of just distributing the latest DLLs they have to be installed onto the target system. See Mark Salsbery's post for further information.
Redistributing Visual C++ Files[^]
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|