|
Can I stop reading when the floppy device is reading a file?
By the way, which action can be confirmed
that is acting on the Floppy?
|
|
|
|
|
I truly don't know. I never had to deal with those kinds of questions. Sorry, I can't help you.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Although you can't help me I still appreciate your replies very much!
Not everything we can do
I see
Thank you
|
|
|
|
|
You're welcome.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Are you asking if you can terminate a read operation when it is half-finished?
If so, you can use overlapped I/O and use CancelIo() to cancel it before it completes.
Why do you need to do this? It's not very common reading from files; more common reading from serial ports and "slow" devices.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
The LED dosn't shut off immediately
At last I change my codes in my loop partition like:
while(true)
{
Sleep(3500);
m_hFloppyDisk = CreateFile(TEXT("A:"),
0,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
}
The result is that LED can go out after about every four seconds' being on
which seems like blinking to some extend.
Not very like.
|
|
|
|
|
You can't make the LED stay on longer or shorter. The timeout is set to 2 seconds by default in hardware, and the only way you can change it is to reprogram the floppy drive controller. Windows does not support this, so there's no way you can do it, short of writing a new floppy disk driver.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thank you very much!
Well, I am feeling I have to learn more knowledge
or I can't make a living any longer
Yes, I have known what you have said
Thank you again!
|
|
|
|
|
I've created a new dialog menu box and one drop-down menu item. I want to enter text information into the program which will appear in a new screen when the user clicks the menu item I just created(I hope I said that clearly). My questions:
1. Should I create a Document class to accomplish this?
2. I noticed that VC++ 6.0 gives the option to create different types of documents(Power point, access, Word, etc.). I am a bit confused on this. Is the how to enter text into my new document class, by entering info into a Word document? What is the standard way that programmers enter the text and pictures into their document class?
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
that depends on how and where the text is entered...
Do you enter text in the already existing dialog or do you enter the text in the new window?
I could be wrong, but I thing that the standard way for storing text into a CDocument class is just to derive your own. That way you have a class that fits whatever you need.
|
|
|
|
|
I'm wanting to do exactly what you said, but how do I go about it. I want to create my own text (or copy/paste in text from other documents I've typed out). Thanks.
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
If you want to create your own text you can derive your class from CView and implement the OnChar method. Then display the character...
The other thing you can do is use a CRichEditView,... You can find everything you need in the msdn library.
Good luck
|
|
|
|
|
Thanks, that's exactly what I wanted to know.
Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
I want to generate GUID for my objects inside my application without the need of using external GUIDGEN utility.
|
|
|
|
|
Use the function
HRESULT CoCreateGuid(
GUID *pguid
);
Hope that helps
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Excellent
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have two questions:
First, I'm trying to get the following program to work. I keep getting an error message that the "DDRAW.LIB" include file cannot be found. I did go into TOOLS/OPTIONS to specify the WINDOWS/SYSTEM directory where the Ddraw.dll is located. What am I doing wrong? The compiler still can't find DDRAW.LIB.
Second, I can see in the program below that there are definitions that need to go into a header file, but I'm not sure what to place in the header file. COuld someone please help me out with this? Thanks much, Dave
<br />
<br />
<br />
#define WIN32_LEAN_AND_MEAN // make sure certain headers are included correctly<br />
<br />
#include windows.h
#include windowsx.h
#include mmsystem.h
#include ddraw.h
<br />
#include stdlib.h
#include stdio.h<br />
#include math.h<br />
#include float.h<br />
<br />
<br />
#define WINDOW_CLASS_NAME "WINDOW_CLASS" // this is the name of the window class<br />
<br />
<br />
#define SCREEN_WIDTH 640 // the width of the viewing surface<br />
#define SCREEN_HEIGHT 480 // the height of the viewing surface<br />
#define SCREEN_BPP 8 // the bits per pixel<br />
#define MAX_COLORS 256 // the maximum number of colors<br />
<br />
<br />
typedef unsigned char UCHAR;<br />
<br />
<br />
<br />
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)<br />
#define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)<br />
<br />
<br />
int DD_Init(HWND hwnd);<br />
int DD_Shutdown(void);<br />
int Set_Pal_Entry(int index, int red, int green, int blue);<br />
<br />
void Game_Init(void);<br />
void Game_Main(void);<br />
void Game_Shutdown(void);<br />
<br />
<br />
LPDIRECTDRAW lpdd = NULL;
LPDIRECTDRAWSURFACE lpddsprimary = NULL;
LPDIRECTDRAWPALETTE lpddpal = NULL;
PALETTEENTRY color_palette[256];
DDSURFACEDESC ddsd;
DDSCAPS ddscaps;
HRESULT ddrval;
HWND main_window_handle = NULL;
UCHAR *video_buffer = NULL;
<br />
<br />
<br />
<br />
int DD_Init(HWND hwnd)<br />
{<br />
<br />
int index;
<br />
if (DirectDrawCreate(NULL,&lpdd,NULL)!=DD_OK)<br />
{<br />
DD_Shutdown();<br />
return(0);<br />
}
<br />
if (lpdd->SetCooperativeLevel(hwnd, DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE |<br />
DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX)!=DD_OK)<br />
{<br />
DD_Shutdown();<br />
return(0);<br />
}
<br />
if (lpdd->SetDisplayMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP)!=DD_OK)<br />
{<br />
DD_Shutdown();<br />
return(0);<br />
}
<br />
ddsd.dwSize = sizeof(ddsd);<br />
ddsd.dwFlags = DDSD_CAPS;<br />
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;<br />
<br />
if<br />
(lpdd->CreateSurface(&ddsd,&lpddsprimary,NULL)!=DD_OK)<br />
{<br />
DD_Shutdown();<br />
return(0);<br />
}
<br />
<br />
memset(color_palette,0,256*sizeof(PALETTEENTRY));<br />
<br />
for (index=0; index<256; index++)<br />
{<br />
if ((index / 64)==0)<br />
{<br />
color_palette[index].peRed = index*4;<br />
color_palette[index].peGreen = index*4;<br />
color_palette[index].peBlue = index*4;<br />
}
else<br />
if ((index / 64)==1)<br />
color_palette[index].peRed = (index%64)*4;<br />
else<br />
if ((index / 64)==2) <br />
color_palette[index].peGreen = (index%64)*4;<br />
else<br />
if ((index / 64)==3)<br />
color_palette[index].peBlue = (index%64)*4;<br />
<br />
color_palette[index].peFlags = PC_NOCOLLAPSE;<br />
<br />
}
<br />
if (lpdd->CreatePalette((DDPCAPS_8BIT | DDPCAPS_INITIALIZE),color_palette,&lpddpal,NULL)!=DD_OK)<br />
{<br />
DD_Shutdown();<br />
return(0);<br />
}
<br />
lpddsprimary->SetPalette(lpddpal);<br />
<br />
return(1);<br />
<br />
}
<br />
<br />
int DD_Shutdown(void)<br />
{<br />
<br />
if (lpdd)<br />
{<br />
if(lpddsprimary)<br />
{<br />
lpddsprimary->Release();<br />
lpddsprimary = NULL;<br />
}
<br />
lpdd->Release();<br />
lpdd = NULL;<br />
<br />
return(1);<br />
<br />
}
else<br />
return(0);<br />
<br />
}
<br />
<br />
int Set_Pal_Entry(int index, int red, int green, int blue)<br />
{<br />
<br />
PALETTEENTRY color;
<br />
color.peRed = (BYTE)red;<br />
color.peGreen = (BYTE)green;<br />
color.peBlue = (BYTE)blue;<br />
color.peFlags = PC_NOCOLLAPSE;<br />
<br />
lpddpal->SetEntries(0,index,1,&color);<br />
<br />
memcpy(&color_palette[index],<br />
&color,<br />
sizeof(PALETTEENTRY));<br />
<br />
return(1);<br />
<br />
}
<br />
<br />
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)<br />
{<br />
<br />
HDC hdc;
PAINTSTRUCT ps;
<br />
<br />
switch(msg)<br />
{ <br />
case WM_CREATE:<br />
{<br />
return(0);<br />
} break;<br />
<br />
case WM_PAINT:<br />
{<br />
hdc = BeginPaint(hwnd,&ps); <br />
EndPaint(hdc,&ps);<br />
<br />
return(0);<br />
} break;<br />
<br />
case WM_DESTROY:<br />
{<br />
PostQuitMessage(0);<br />
return(0);<br />
} break;<br />
<br />
default:break;<br />
<br />
}
<br />
return (DefWindowProc(hwnd, msg, wparam, lparam));<br />
<br />
}
<br />
<br />
int WINAPI WinMain( HINSTANCE hinstance,<br />
HINSTANCE hprevinstance,<br />
LPSTR lpcmdline,<br />
int ncmdshow)<br />
{<br />
WNDCLASSEX winclass;
HWND hwnd;
MSG msg;
<br />
<br />
winclass.cbSize = sizeof(WNDCLASSEX);<br />
winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;<br />
winclass.lpfnWndProc = WindowProc;<br />
winclass.cbClsExtra = 0;<br />
winclass.cbWndExtra = 0;<br />
winclass.hInstance = hinstance;<br />
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);<br />
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);<br />
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);<br />
winclass.hbrBackground = GetStockObject(BLACK_BRUSH);<br />
winclass.lpszMenuName = NULL;<br />
winclass.lpszClassName = WINDOW_CLASS_NAME;<br />
<br />
if (!RegisterClassEx(&winclass))<br />
return(0);<br />
<br />
if (!(hwnd = CreateWindowEx(WS_EX_TOPMOST,<br />
WINDOW_CLASS_NAME,
"You can't See This!",
WS_VISIBLE | WS_POPUP,<br />
0,0,
GetSystemMetrics(SM_CXSCREEN),<br />
GetSystemMetrics(SM_CYSCREEN), <br />
NULL,
NULL,
hinstance,
NULL)))
return(0);<br />
<br />
ShowCursor(0);<br />
<br />
main_window_handle = hwnd;<br />
<br />
if (!DD_Init(hwnd))<br />
{<br />
DestroyWindow(hwnd);<br />
return(0);<br />
}
<br />
Game_Init();<br />
<br />
while(1)<br />
{<br />
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))<br />
{ <br />
if (msg.message == WM_QUIT)<br />
break;<br />
<br />
TranslateMessage(&msg);<br />
<br />
DispatchMessage(&msg);<br />
}
else<br />
{<br />
<br />
memset(&ddsd,0,sizeof(ddsd));<br />
ddsd.dwSize = sizeof(ddsd);<br />
lpddsprimary->Lock(NULL,&ddsd,DDLOCK_SURFACEMEMORYPTR,NULL);<br />
video_buffer = (UCHAR *)ddsd.lpSurface;<br />
<br />
Game_Main();<br />
<br />
lpddsprimary->Unlock(ddsd.lpSurface);<br />
<br />
}
<br />
}
<br />
DD_Shutdown();<br />
<br />
Game_Shutdown();<br />
<br />
return(msg.wParam);<br />
<br />
}
<br />
<br />
void Game_Init(void)<br />
{<br />
}
<br />
<br />
void Game_Shutdown(void)<br />
{<br />
}
<br />
<br />
void Game_Main(void)<br />
{<br />
<br />
static int px = SCREEN_WIDTH/2,
py = SCREEN_HEIGHT/2,<br />
color = 0;
<br />
<br />
"VK_"<br />
scan codes<br />
<br />
if (KEY_DOWN(VK_ESCAPE))<br />
PostMessage(main_window_handle,WM_CLOSE,0,0);
<br />
if (KEY_DOWN(VK_RIGHT))<br />
if (++px>SCREEN_WIDTH-8) px=8;<br />
<br />
if (KEY_DOWN(VK_LEFT))<br />
if (--px<8) px=SCREEN_WIDTH-8;<br />
<br />
if (KEY_DOWN(VK_UP))<br />
if (--py<8) py=SCREEN_HEIGHT-8;<br />
<br />
if (KEY_DOWN(VK_DOWN))<br />
if (++py>SCREEN_HEIGHT-8) py=8;<br />
<br />
if (KEY_DOWN('C'))<br />
{<br />
if (++color>=4)<br />
color=0;<br />
Sleep(100);<br />
}
<br />
for (int pixels=0; pixels<32; pixels++)<br />
video_buffer[(px-4+rand()%8)+(py-4+rand()%8)*SCREEN_WIDTH] = (color*64)+rand()%64;<br />
<br />
<br />
Sleep(14);
<br />
<br />
}
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
Hello,
The .lib file is not located in the windows\system\ dir. the dll you want to use is located there... already ...
I don't know if I'm sure, but the .lib file is used by the compiler. the dll by the program.
In the VC++ directory you should find the "lib" dir. DDraw.bib is located there!
for the header file:
I'm sure on this part . All your definitions, prototype declarations (headers ) and macro's should be there. The implamentation shoud be in the implementation file (*.cpp).
hope this helps.
|
|
|
|
|
Thanks Bob,
For some reason my compiler is saying that it cannot find the Ddraw.lib "include" file. The file is located in the MFC directory of my Visual Studio, but my compiler doesn't see it even though I have set the directory to it in TOOLS/OPTIONS. Hmmmm
Thanks Much, Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
1. The more code you post, the less likely you are to get a reply. You can't expect someone to read through that much code.
2. Any definitions that you want to use in more than source one file should be in a header file.
3. You need to specify the path to ddraw.lib, not ddraw.dll. And it's not an include file. It's a library file.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Will do Ryan, Thanks. I only posted the code in hopes that someone would draw a line between what should be in a header file and what should not. I agree with you.
Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
Hi all,
I want to trace emails recieved and sent through my PC..throught any channel..either outlook or excxhange or OE..or hotmail yahoo or anyother..can anyone suggest me something..or give me any ideas..any pointers and ideas are highly appreciated..thanks a lot in advance..
Himanshu
|
|
|
|
|
I have been trying to download the Platform SDK containing GDI+. But unable to search it (because I do not know the release name). Will anyone help me?
Thanks.
|
|
|
|
|
Download it from here[^].
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
You beat me to it!
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|