|
hi everyone..
i'm having this stupid problem that i don't know how to solve:
DWORD Size = GetFileSize(..);
int Arr[Size];
the problem is that Arr doesn't accept Size to be the number of elements!!!
|
|
|
|
|
I don't think arrays like to be dymically allocated. I think you have to give it a constant number.
Try using CStringArray instead.
Hope this helps.
|
|
|
|
|
int *pArr = new int[Size];
|
|
|
|
|
|
Not sure in C++ (yet anyways) but in VB there is a keyword to resize the array and to save the info in the array.
Killer coding ninja monkeys do exsist !
There is no spoon? How the frell do I eat my frosted mini-wheats
|
|
|
|
|
thanx very much..i used the allocating in the heap way since i'm not intending to use MFC (CMap)..
|
|
|
|
|
Hello, I hope someone can help me here. I've been working on a project that allows me to inject data into the stream of keyboard and mouse devices. So far I have, I believe, succesfully called DefineDosDevice and CreateFile to open HANDLE's to the mouse and keyboard.
However, I am now stuck because I cannot find any documentation or information on how to use DeviceIoControl in the way I want to. MSDN only documents the use of disk geometry stuff, which isn't what I want.
As I understand it, now that I have the handle for the mouse, I should be able to call DeviceIoControl. I am not sure on the arguments, so here's what I know:
DeviceIoControl(m_hMouse,
CTL_CODE(
FILE_DEVICE_MOUSE,
0x802,
METHOD_BUFFERED, FILE_ANY_ACCESS),
NULL, 0,
NULL, 0,
NULL, NULL)
So, based on this, can anyone explain to me, at the very least, what arguments to send DeviceIoControl to control mouse clicks and movement?
Thanks, much appreciated.
|
|
|
|
|
Not to divert you form your endeavors, but you should also examine the function "keybd_event" and the "Raw Input" section of MSDN. They might help you out too.
|
|
|
|
|
Thank you, but they were unsuccessful.
As it turns out, I figured out what I needed to do. I rewrote new mouclass.sys and kbdclass.sys drivers. The need to access low level input was required, keybd_event and SendInput were insufficient, and they communicate on too high of a level, with windows messages.
Anyway, my new drivers work great, DeviceIoControl can control the mouse as it if were physically being moved. Wasn't a fun ride, but it works.
Thanks for your reply anyway.
|
|
|
|
|
Hi,
Just wondering if anyone can point me to a C++ function or run-time library call that I can use to create a new folder like this:
NewFolder("C:\\Engineering Data\\Diagnostic Data\\2004_10_15");
I did find SHFileOperations but that seems to be used for deleting, renaming or moving files. I just need to create a new folder under an already existing folder. The higher folder "Diagnostic Data" as used above will always exist if that matters.
Thanks,
Robert
|
|
|
|
|
|
CreateDirectory("C:\\Engineering Data\\Diagnostic Data\\2004_10_15") will fail if "C:\\Engineering Data\\Diagnostic Data\\" does not exist.
|
|
|
|
|
vcplusplus wrote:
CreateDirectory("C:\\Engineering Data\\Diagnostic Data\\2004_10_15") will fail if "C:\\Engineering Data\\Diagnostic Data\\" does not exist.
Correct but did you read the initial post?
I just need to create a new folder under an already existing folder. The higher folder "Diagnostic Data" as used above will always exist if that matters.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
You're right, my mistake.
|
|
|
|
|
|
Hi,
I hope someone could help me with this because i'm totally stuck.
The problem i have is an application that locks my cdrom drive so it can not read data cd's.
I have used a program called API spy to figure out how the drive is locked. It calls the function "DeviceIoControl" with dwControlCode 0x24014 and 0x24028 which is functions IOCTL_CDROM_GET_VOLUME and IOCTL_CDROM_SET_VOLUME.
After this the drive is locked, i have tried to unlock it by calling IOCTL_CDROM_SET_VOLUME and revert to the original values but the drive is still locked.
The drive remains locked until the process that locked it terminates.
Any help appreciated!
--Genfors
|
|
|
|
|
Genfors wrote:
The drive remains locked until the process that locked it terminates.
If you know the name of the program that is locking the drive, why not just terminate it, and possibly remove it from your machine?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
If you know the name of the program that is locking the drive, why not just terminate it, and possibly remove it from your machine?
I need that program up and running it does other thing besides locking my cd.
It's a comercial presentation software, i don't know why but their runtime component locks the cd or sets it in a CD Audio only mode.
|
|
|
|
|
Your problem is the application has told Windows that it is the only thing that should be allowed to use the drive. Windows obeys this, like it should.
Call your vender and see if there is soemthing you can do. The DeviceIoControl function call has nothing to do with it, it is the open call.
|
|
|
|
|
Call your vender and see if there is soemthing you can do. The DeviceIoControl function call has nothing to do with it, it is the open call.
I have tried to reach the Vendor but they have not responded, yet.
I tried to create an application that used the same DeviceIo calls that the comercial app and that locks the drive in the same way so it seems like the call with DeviceIoControl has something to do with it.
|
|
|
|
|
Hai,
I am working on win32 vc++.I have set of commands that i have to send it to serial port..how should i do that programatically..
thanks a lot..
|
|
|
|
|
You simply opens the port using CreateFile. The filename is the name of the serial port.
After that you can send and receive using ReafFile and WriteFile.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
For additional info, please see Communication Functions in VC++ MSDN.
|
|
|
|
|
Hi, I am trying to make a program where the program asks me for a password and if the password is correc t it will tell me something important whereas if the password is incorrect it will tell me that the password is incorrect.
I have used MFC so far. Could any body help me read what is written in the Edit box to verify the password. Oh and yes I am completely new to this so please dumb it down a bit as well.
The code I have so far is:
void CpasswrdtestingDlg::OnOK()
{
// TODO: Add extra validation here
char *s1,*s2;// Declareing identifiers
(s1) = GetDlgItem( IDC_EDIT1 ); // Reading input from IDC_EDIT1 (NEEDS IMPROVEMENT)
s2 = "my password"; // Defines the password
// Outputs to give out to the user.
if (s1 == s2)
{
MessageBox ("Hello well done you got it right");
MessageBox ("Yey");
}
else
MessageBox ("It didnt work. Try again!!");
}
I would greatly thank full if anybody could help me with this. Thanks.
Buyer1
Buyer1
|
|
|
|
|
GetDlgItem() returns a CWnd*, not a char* .
CWnd::GetWindowText returns a CString; it might be usefull.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|