|
aroli vijay wrote: so i just want to confirm whether they will work on Windows98.
According to MSDN, they are compatible with Windows 98 et al.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you are writing to and reading from an external port such as COM1, COM2, LPT1 etc. the better alternative is to use the CreateFile, WriteFile, ReadFile Windows API functions. However, i think that Windows does not allow low-level access to ports in user mode(surely true on NT systems). Then you will have to switch to kernel-mode or another tool.
|
|
|
|
|
i was trying to read a sector of data from the Hard disk using the base address of the Hard disk controller. i am not able to read data from the hard disk. i was using inp() and outp() functions. they dont seem to work in windows98. can u please suggest me any alternatives?? thanks..
vijay.
|
|
|
|
|
I guess you are trying to access a crashed hard disk. Anyway, to my knowledge, if you're trying to run the program in a Windows platform, the OS will deny this operation (An error will pop-up). If you just want to run the program in Windows, you would need to work on kernel-mode programming, a rather cumbersome work . Try booting your PC with DOS only, your program should run..!
|
|
|
|
|
hello sir!! thanks for the information. yes, i am trying to acces a disk and yes, my code works fine in DOS environment. but i want to write the code that does the same work, but in a windows98 enviroment (not in windows XP/NT/2000). i am ready to do the Kernel-mode programming. can u please suggest me what to do?? how should i start and how to proceed?? and hey, i just now read that _outp(), _inp()are compatible with windows 98.. check out the following link..
http://msdn2.microsoft.com/en-us/library/733szwah.aspx[^]
-- modified at 9:20 Thursday 21st September, 2006
vijay.
|
|
|
|
|
aroli vijay wrote: i was trying to read a sector of data from the Hard disk...
So why not simply call CreateFile("\\\\.\\C:", ...) or CreateFile(“\\\\.\\PhysicalDrive0”, ...) to open disk and then use ReadFile() to read disk sector by sector.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi all,
I am trying to develop an application that interacts with a console mode application. First I created the console, ran the cmd.exe on it and redirected the Standard input so that my app can write value to the command processor. All goes well until I write to the console, in this case my text does not appear on the command prompt. When I debug, I see that WriteFile() is successful and the desired no. of bytes are written to the console handle. Can anyone identify what I am missing from the code I've used below.(echo is on by default, isn't it?). As u can see, I'm trying to display "hi" on the command prompt...!
AllocConsole();<br />
HANDLE hInRead, hInWrite,hInWriteDup;
HANDLE hOutRead,hOutWrite,hOutReadDup;
HANDLE hSavedOut=GetStdHandle(STD_OUTPUT_HANDLE);<br />
<br />
SECURITY_ATTRIBUTES sa;<br />
sa.bInheritHandle=TRUE;<br />
sa.lpSecurityDescriptor=NULL;<br />
sa.nLength=sizeof(SECURITY_ATTRIBUTES);<br />
<br />
CreatePipe(&hInRead,&hInWrite,&sa,0);<br />
CreatePipe(&hOutRead,&hOutWrite,&sa,0);<br />
<br />
DuplicateHandle(GetCurrentProcess(),hInWrite,GetCurrentProcess(),&hInWriteDup, 0,<br />
FALSE,DUPLICATE_SAME_ACCESS);<br />
DuplicateHandle(GetCurrentProcess(),hOutRead,GetCurrentProcess(),&hOutReadDup, 0,<br />
FALSE,DUPLICATE_SAME_ACCESS);<br />
CloseHandle(hInWrite);<br />
CloseHandle(hOutRead);<br />
hInWrite=INVALID_HANDLE_VALUE;<br />
hOutRead=INVALID_HANDLE_VALUE;<br />
<br />
ZeroMemory( &si, sizeof(si) );<br />
si.cb = sizeof(si);<br />
si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);<br />
si.hStdInput = hInRead;
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);<br />
si.wShowWindow = SW_SHOW;<br />
si.dwFlags = STARTF_USESTDHANDLES| STARTF_USESHOWWINDOW;
<br />
ZeroMemory( &pi, sizeof(pi) );<br />
<br />
<br />
if(!::CreateProcess(NULL,"cmd",<br />
NULL,NULL,FALSE,CREATE_NEW_PROCESS_GROUP,
NULL,<br />
NULL,&si,&pi))<br />
AfxMessageBox("Process Error",MB_ICONERROR,0);<br />
DWORD num;<br />
if(!WriteFile(hInWriteDup,"Hi",3,&num,NULL))<br />
AfxMessageBox("Write to pipe failed",MB_ICONERROR,0);
|
|
|
|
|
how can i access a file locked by other application
i think if i hook the application, and capture the file io message
but how can i do
someone could help me? thanks a lot
|
|
|
|
|
You can't. The file system is what's locking you out.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i see a application,it can monitor a locking mdb file,and capture the file change on real time, keep the change.what do you think how it did?
|
|
|
|
|
You didn't ask to tell if a file gets locked, you asked how to take a locked file and access it. You can't do that. Noticing that a file has become locked is another thing entirely. Office files actually generate a temp file when they lock, so doing it for any office doc is trivial, you can just look for a file to come into existance. But I'm sure it can be done for any file type, all the same.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanks for your answers, and i would like to talk about the question with.
ok,i have a mistake,i know the office doc's temp file. but you know the outlook file - .pst,when you open outlook application, the .pst file will be locked. But the monitor still can do it.
|
|
|
|
|
Perhaps you are looking for ReadDirectoryChangesW() or FindFirstChangeNotification() .
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi i have a CFormView on my SDI and i have successfully created and able to use it but when i instanciated it on my view class and declared it as public it flags with this error..why?
error C2079: 'dlgFrmViewModified' uses undefined class 'CFrmViewModified'
positive vibes
|
|
|
|
|
Please include the header file of class CFrmViewModified
Rinu Raj
|
|
|
|
|
Seems likely that 'CFrmViewModified.h' has not been included in the place where you're trying to create this variable. Add #include "FrmViewModified.h" ( at a guess ) to your view header file.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Did you see MSDN
From the MSDN:
Compiler Error C2079
'identifier' uses undefined class/struct/union 'name'
|
|
|
|
|
I'm not intended to ask a question that reapeted many times!
My Question is simple and not simple! because i saw for that in : MSDN, books, forums, searchable areas of internet!, CodeGuru.com!, and some other programming sites, many articles, and ... .
OK! Question : How can I copy a UniCode(Farsi) string to the clipboard AS that can be pasted CORRECTLY later (at least in my program). END!
I used all the codes, change them, change the variable types (in many combinations) and ..., BUT there were at the best case SOME not-letter symbols and in worst case
all the string was pretty symbols! and I don't know how these many coders use such codes with NO problem!
NOW! : with this brief Introduction! it clear that I'm looking for a NEW, WORKING, FULL CORRECT, because my eyes are flicking by looking at OLD, NOT WORKING, WRONG, codes! (and i'm afraid of facing again with 'HGLOBAL' man!)
AT THE END! : Thanks for your reading! just don't give me the BAD code!
Thanks!
|
|
|
|
|
CString csText(_T("Unicode string"));
HGLOBAL hglbCopy;
// Open the clip board and set the data in to the clip board.
if( OpenClipboard(0) )
{
EmptyClipboard();
wchar_t *wcBuffer = 0;
hglbCopy = GlobalAlloc( GMEM_MOVEABLE,
( csText.GetLength() + 1 ) * sizeof (wchar_t) );
wcBuffer = ( wchar_t* )GlobalLock( hglbCopy );
wcscpy( wcBuffer, csText );
GlobalUnlock( hglbCopy );
SetClipboardData( CF_UNICODETEXT, hglbCopy );
CloseClipboard();
rgds
aneesh
|
|
|
|
|
Thanks aneesh.
but the problem is to converting CString to wchar_t * because the line :
wcscpy( wcBuffer, csText );
will cause thi error (in VC++ 6) :
error C2664: 'wcscpy' : cannot convert parameter 2 from 'class CString' to 'const unsigned short *'
The Main Problem !
|
|
|
|
|
Please put preprocessor defnition _UNICODE ( project->Settings->C/C++->Preprocessor->Preprocessor defnitions )
Rinu Raj
|
|
|
|
|
Thanks Rinu_Raj.
First : Then, I should add _T() to any string(LPCTSTR) that passed as an arguman for a function, is it right ?
Second : I got two errors :
1. error LNK2001: unresolved external symbol _WinMain@16
2. fatal error LNK1120: 1 unresolved externals
|
|
|
|
|
You may add wWinMainCRTStartup
Project->Settings->Link->Entry-Point Symbol wWinMainCRTStartup
Rinu Raj
|
|
|
|
|
Also if u didn't put _UNICODE definition, u cannot represent a unicode string in CString.
nave
|
|
|
|
|
Thanks All...
A little question :
Is there any another way instead of adding _T(), for each string, to convert them from 'LPTSTR' to 'wchar_t *' ? (I wrote a long code and now it's a little difficult to change!)
|
|
|
|
|