The loop below doesn't work, I was wondering if anyone can help me. I need to create an infinate loop around the while condition.
The error states that 'd' is undeclared
Thank you all :) -
#include "windows.h"
-
#include "winioctl.h"
-
#include <string>
-
#include <iostream>
-
using std::string;
-
using namespace std;
-
-
-
int main(int argc, char* argv[])
-
{
-
-
-
string sdrive("\\\\.\\e:");
-
-
HANDLE hcd = CreateFile(sdrive.c_str(),
-
GENERIC_READ,
-
FILE_SHARE_READ,
-
NULL,
-
OPEN_EXISTING,
-
FILE_ATTRIBUTE_READONLY,
-
NULL);
-
-
-
-
-
while(1)
-
{
-
-
DeviceIoControl(hcd, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0,
-
&d,NULL);
-
DeviceIoControl(hcd, IOCTL_STORAGE_LOAD_MEDIA, NULL, 0, NULL, 0,
-
&d,NULL);
-
-
}
-
CloseHandle(hcd);
-
return 0;
-
-
}
3 1521
Well, define d.
BTW: You are not using <tchar.h> and none of the TCHAR mappings. All Windows is Unicode and this ASCII stuff you are writing is converted to Unicode by the ASCII Win32 function wwho then calls the Unicode verison of that Win32 function, and then converts any returned Unicide strings back to ASCII and then returns to you.
You have to use <tchar>. That means _tmain(), etc...
Well, define d.
BTW: You are not using <tchar.h> and none of the TCHAR mappings. All Windows is Unicode and this ASCII stuff you are writing is converted to Unicode by the ASCII Win32 function wwho then calls the Unicode verison of that Win32 function, and then converts any returned Unicide strings back to ASCII and then returns to you.
You have to use <tchar>. That means _tmain(), etc...
I've defined d, so is it not possible to implement a loop in this program using what I've made? How would I go about using the <tchar.h> variable?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Knocked Wood |
last post by:
Hi,
I looked around and can't find anything on this at all and can not get
it to work for IE.
I'm trying to loop multiple sounds on a game, with three unique
variables, when a link is clicked....
|
by: Mountain Bikn' Guy |
last post by:
Take some standard code such as shown below. It simply loops to add up a
series of terms and it produces the correct result.
// sum numbers with a loop
public int DoSumLooping(int iterations)
{...
|
by: Liz Malcolm |
last post by:
Hello and TIA for guidance.
I am building a reusable search procedure (thanks go to Graham Thorpe
for his example that set me on my way). Everything works up until the
2nd match is found, the...
|
by: Aaron Ackerman |
last post by:
What is the sytax for exiting a for loop in C#?
|
by: outforblood74 |
last post by:
Ok here's the deal, the for each statment using VB 6 doesn't loop all
the objects. I would like it to close all the IE browsers that are
open, but it doesn't work. And now I'm concerned that its...
| |
by: Doug_J_W |
last post by:
I have a Visual Basic (2005) project that contains around twenty
embedded text files as resources. The text files contain two columns
of real numbers that are separated by tab deliminator, and are...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| | |