CreateFile function Programming Software Development by mahnaz0098 … i connect to it some LEDs . i want to use CreateFile and WriteFile functions but i don't know that i… use LPT1 and LPT2 or COM1 and COM2 in CreateFile function. h = CreateFile( L"LPT1", // pointer to name of the… Re: CreateFile function Programming Software Development by Ancient Dragon … by using PROCMON.EXE from SysInternals to monitor calls to CreateFile() triggered by redirecting the output from DIR to a mapped… LPT port eg. dir >lpt3 >CreateFile("LPT3", GENERIC_WRITE | FILE_READ_ATTRIBUTES, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0… CreateFile() Serial Communication with USB device Programming Software Development by fredyip … GPS data from a GPS usb device. I am using CreateFile() and all seems to be all right except for time… continuously send the data. I wrote a C++ program using CreateFile(), and I can collect the data streamed from the GPS… CreateFile on system volume Programming Software Development by crazylunatic I am writing a small app which uses CreateFile to get handles to the volumes present on a system. … GENERIC_ALL and the share mode is FILE_SHARE_WRITE. The call to CreateFile is successful for all volumes barring the system volume. I… Re: CreateFile on system volume Programming Software Development by NathanOliver … you out Physical Disks and Volumes You can use the CreateFile function to open a physical disk drive or a volume… system, even when the noncached option is not specified in CreateFile. You should assume that all Microsoft file systems open volume… CreateFile returns ERROR_FILE_NOT_FOUND when using interface path Programming Software Development by Thew … problem when I try to connect to my webcam using CreateFile. Using the SetupApi, I found the interface path of my… I supposed that when I use this interface path in CreateFile, I will be able to read from the webcam. But… Re: CreateFile() problems on Mobile 5.0 Programming Software Development by Ancient Dragon On your Mobile 5.0 computer, after exiting the application check the computer's memory to see that it really exited and not just hidden. Also, make sure the program closes the port before exiting. What is it trying to do in that tight loop ? Trying to open the port, but the CreateFile() failes? Re: Array of createfile handles Programming Software Development by lostangel556 …, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL); comports[1] = CreateFile("\\\\.\\COM7", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL…); comports[2] = CreateFile("\\\\.\\COM8", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL… Re: Array of createfile handles Programming Software Development by mitrmkar …, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL); comports[1] = CreateFile("\\\\.\\COM7", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL…); comports[2] = CreateFile("\\\\.\\COM8", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL… Failure of CreateFile() Programming Software Development by bops …szContent ) { HANDLE hFile; BOOL bSuccess = FALSE; DWORD dwTextLength; hFile = CreateFile( "data.txt" , GENERIC_WRITE , 0 , NULL , CREATE_ALWAYS ,…"setPassword()"); } else { MessageBox(hwnd,"setPassword(): CreateFile failed.",0,0); LastErrorMessage( "setPassword()"); // … Unexplained INVALID_HANDLE_VALUE from CreateFile() Programming Software Development by killdude69 …Scintilla and am currently having some issues with the CreateFile() function. It does not return an error when…help me very much. I have looked up the CreateFile() syntax on MSDN, and every parameter has the… an error. I am using Windows Vista. [CODE] file = CreateFile(fileName, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (… Array of createfile handles Programming Software Development by lostangel556 … usual syntax. e.g. [CODE]HANDLE comports[10]; comports[0] = CreateFile("\\\.\\COM6", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);[/CODE… written to the port // Open COM port(s) HANDLE comport=CreateFile("\\\.\\COM6", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); DCB… Re: Unexplained INVALID_HANDLE_VALUE from CreateFile() Programming Software Development by Yiuca … value of GetLastError() for you?) Because the return value of CreateFile() is INVALID_HANDLE_VALUE only if the function fails. As a 2nd… "guess" are you using the CreateFile() on a file that is deemed already open with the… Re: Unexplained INVALID_HANDLE_VALUE from CreateFile() Programming Software Development by killdude69 … value of GetLastError() for you?) Because the return value of CreateFile() is INVALID_HANDLE_VALUE only if the function fails. As a 2nd… "guess" are you using the CreateFile() on a file that is deemed already open with the… Re: Array of createfile handles Programming Software Development by lostangel556 … adding another \ escape character at the start [icode]comports[0] = CreateFile("\\\\.\\COM6", /* blabla */[/icode][/QUOTE] Thanks for the above… below as the code. [CODE]HANDLE comports[10]; comports[0]=CreateFile("\\\\.\\COM6", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);[/CODE… Re: Array of createfile handles Programming Software Development by lostangel556 … below as the code. [CODE]HANDLE comports[10]; comports[0]=CreateFile("\\\\.\\COM6", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);[/CODE… found the compiler wont allow me to assign the first createfile into comports[0]. It will let me use comports[1… Re: Failure of CreateFile() Programming Software Development by bops …] char * getContent( ) { HANDLE hFile; BOOL bSuccess = FALSE; LPSTR pszFileText; hFile = CreateFile( PASSWORD_FILE , GENERIC_READ , FILE_SHARE_READ , NULL , OPEN_EXISTING , 0 , NULL ); if( hFile != INVALID_HANDLE_VALUE… Re: Array of createfile handles Programming Software Development by Ancient Dragon That first code snippet compiled ok for me after adding another \ escape character at the start [icode]comports[0] = CreateFile("\\\\.\\COM6", /* blabla */[/icode] Re: Array of createfile handles Programming Software Development by Ancient Dragon Here is the complete program [code] #include <windows.h> int main() { HANDLE comports[10]; comports[0] = CreateFile("\\\\.\\COM6", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); return 0; } [/code] Re: Array of createfile handles Programming Software Development by nezachem Your problem is that the line [QUOTE][CODE]comports[0]=CreateFile("\\\\.\\COM6", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);[/CODE][/… Win32 CreateFile/WriteFile() problems Programming Software Development by Chuckleluck I'm having trouble using the CreateFile() and WriteFile() functions. Here's the code I've written: […++) { cout << cData[i] << endl; } HANDLE hFile = CreateFile(TEXT("FileBGP.txt"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL… How to open a directory using createfile() ? Programming Software Development by krishnampkkm hii How to open a directory using createfile() ? Any idea..? Thanking you. Re: How to open a directory using createfile() ? Programming Software Development by kvprajapati [QUOTE=krishnampkkm;889855]hii How to open a directory using createfile() ? Any idea..? Thanking you.[/QUOTE] Use FILE_FLAG_BACKUP_SEMANTICS flag. Re: How to open a directory using createfile() ? Programming Software Development by Ancient Dragon … <fstream> using namespace std; int main() { HANDLE hFile = CreateFile("C:\\users", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0… Using CreateFile() from User Inputs Programming Software Development by marirs07 … port.Im able to Open a new one by using CreateFile(L\\\\.\\Com5, GENERIC_READ | GENERIC_WRITE, 0, // exclusive access NULL, // no security… Re: Using CreateFile() from User Inputs Programming Software Development by Ancient Dragon …; str << "\\\\.\\Com"; str << port; CreateFile(str.str(), ... ); Re: CreateFile function Programming Software Development by Ancient Dragon Which one, if any, of those you use will depend on how the cable is connected to the PC. Is it connected to LPT1, COM port, or USB? Most printers today are USB. Re: CreateFile function Programming Software Development by mahnaz0098 i use this cable for a desktop computer . and i have another question . does this code work on windows 7? CreateFile() problems on Mobile 5.0 Programming Software Development by andreasd Hi there. I do have close to the same issue. When I fist run my application it connect successfully to serial port. Now my app can receive and send data. But when I close my app I has some issues running again. It looks like it goes into a tight loop. I'm running this app on a mobile 5.0. Andreas Re: Failure of CreateFile() Programming Software Development by Dave Sinkula Do you have a minimally complete snippet that I might try to play along with?