|
Have a look at the IDirectSoundNotify interface.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
iam using Doc - View architecture for an MDI application.
I need to scroll the MDI child windows using horizontal and vertical scroll bars.
can anyone let me know the procedure.
thanx in advance
laiju
|
|
|
|
|
Hi guys
I am having a small problem on refreshing screen, because when i insert digital gates that i created on Bitmap they were disappear immediately if i minimize or maximize the screen, any one can give me a hand thanks
From: Guibert
|
|
|
|
|
when u refresh screen , u must reinsert digital gates. Or u can store digital gates in bitmap.
|
|
|
|
|
Does anybody know how you can disable Microsoft Word's Spell check engine using VC++??
Any help would be greatly appreciated.
|
|
|
|
|
Hi,
The codes below used to create a window to display something. Could some of you tell me that how can I display the real time clock (H:M:S) inside this window... Thanks!
hwnd = CreateWindow(
szWinName, /* name of window class */
"Capture Testing", /* title */
WS_OVERLAPPEDWINDOW, /* window style - normal */
CW_USEDEFAULT, /* X coordinate - let Windows decide */
CW_USEDEFAULT, /* Y coordinate - let Windows decide */
480, /* width - let Windows decide */
320, /* height - let Windows decide */
HWND_DESKTOP, /* no parent window */
NULL, /* no menu */
hThisInst, /* handle of this instance of the program */
NULL /* no additional arguments */
);
g_inst=hThisInst;
/* Display the window. */
ShowWindow(hwnd, nWinMode);
UpdateWindow(hwnd);
hWndG=hwnd;
SetTimer(hWndG,1,100,NULL);
|
|
|
|
|
You need to create a control that shows the time, and then set a timer in that control that keeps calling Invalidate, so that a paint message is recieved.
Do you need to use Win32 ? If you can use MFC, it will make life a lot easier for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
An other solution:
Add a hook to WM_PAINT message and use TextOut to display your message...
You can use this method to display bitmap for Digit like in electronic clock or draw line like in mechanic clock.
A++
...
|
|
|
|
|
MSN Article Q138594 tells us how to print raw-data such as EPS file, the snippets are as follows.
But another problem is, the picture always printed on the paper's top-left corner, and always the same size regardless of paper size.
How to set the position and scale for raw data printing? that is,
Can we set printing properties(position and scale) before sending data to printer?
///////////////////////////////////////////////////
DOC_INFO_1 DocInfo;
HANDLE hPrinter;
DWORD dwBytes;
char line[256] = {0};
char *szPrinterName = "HP DesignJet 1050C PS3";
if (OpenPrinter(szPrinterName, &hPrinter, NULL))
{
DocInfo.pDocName = "EPS Document";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = "RAW";
if (StartDocPrinter(hPrinter, 1, (LPBYTE)&DocInfo) != 0)
{
if (StartPagePrinter(hPrinter))
{
Open_EPS_File();
while (Read a line)
WritePrinter(hPrinter, line, strlen(line), &dwBytes);
Close_EPS_File();
}
}
EndPagePrinter(hPrinter);
EndDocPrinter(hPrinter);
ClosePrinter(hPrinter);
}
|
|
|
|
|
Purpose: copy the content from the input file twice to the output file
Problem: only happens ones, program won't write a second file to the outputfile ...
Note: yes the filepaths need to be WIDECHARS
I tried following but this doesn't work :
--------------------------------------------
wchar_t *in = L"D:\\TEST\\in.txt";
wchar_t *out = L"D:\\TEST\\out.txt";
wchar_t * buffer;
long size;
std::wofstream outfile (_wfopen(out,L"a"));
for (int i=0; i<2; i++)
{
std::wifstream infile (_wfopen(in, L"r"));
infile.seekg(0,wifstream::end);
size=infile.tellg();
infile.seekg(0);
// allocate memory for file content
buffer = new wchar_t ;
// read content of infile and write to output file
infile.read (buffer,size);
outfile.write (buffer,size);
delete[] buffer;
infile.close();
}
outfile.close();
----------------------------------------
Now, following is the code to copy the content from a txt file twice into an output file; The filepaths here are char*
(This works)
const char *in = "D:\\TEST\\in.txt";
const char *out = "D:\\TEST\\out.txt";
char * buffer;
long size;
ofstream outfile (out,ofstream::app);
for (int i=0; i<2; i++)
{
ifstream infile (in,ifstream::binary);
infile.seekg(0,ifstream::end);
size=infile.tellg();
infile.seekg(0);
// allocate memory for file content
buffer = new char [size];
// read content of infile and write to output file
infile.read (buffer,size);
outfile.write (buffer,size);
// release dynamically-allocated memory
delete[] buffer;
infile.close();
// end of calls to copy content from the tempfiles
}
outfile.close();
So last piece of code works for file with char* filepaths, but I need something like this for files with wchar_t filepaths
Hope you can help me out ...
|
|
|
|
|
christophek wrote:
Note: yes the filepaths need to be WIDECHARS
The 'basic_ofstream' template behind wofstream takes 'const char*' form of file name. ie, if you want to write wide chars to a file also, still you have to give the file name in ordinary char form while opening it.
christophek wrote:
std::wofstream outfile (_wfopen(out,L"a"));
There is no overloaded constructor for basic_ofstream which takes FILE* returned by _wfopen().
christophek wrote:
buffer = new wchar_t ;
you missed to give the buffer size required.
suhredayan There is no spoon.
|
|
|
|
|
right, it should be buffer = new wchar_t [size]; (the forum mispasted this)
But I don't want to write wide chars to a file, I just want to open a file with a widechar filepath and copy the content to another file also with a widechar filepath
|
|
|
|
|
christophek wrote:
But I don't want to write wide chars to a file, I just want to open a file with a widechar filepath and copy the content to another file also with a widechar filepath
No, there is no way in c++ to pass wide character file names to fstream. However you can use WideCharToMultiByte() to convert your wide char file name before passing to fstream.
suhredayan There is no spoon.
|
|
|
|
|
I'm printing a drawing, which has about 50,000 elements(lines and arcs). The steps is as follows,
1.Create a printer DC;
2.StartDoc(), StartPage();
3.Set mapping mode;
4.loop to draw lines and arcs;
5.EndPage(), EndDoc()
6.Delete printer DC;
The output devices are "HP LaserJet 5000 PCL 6"(max paper size A3), and "HP DesignJet 750C"(max paper size A0).
The problem is, because of so many objects, when the data have been sent to the printer, it will take a long time (several minutes) for the printer to process data before actually printing (the printer's LCD shows: processing data...).
I had try to use bitmap printing, that is, first draw elements to a bitmap, then BitBlt the bitmap to printer DC. But I'm afraid it will be failed to create a bitmap if user select a large paper such as A0.
|
|
|
|
|
Hi all,
Since recently defining WINVER as 0x0500 in a recent project, I get the following compiler messages when building the app:
"NOTE: WINVER has been defined as 0x0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0x0500 or greater, you can only
build beta or test applications. To build a retail application,
set WINVER to 0x0400 or visit http://www.microsoft.com/msdn/sdk
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information."
This link is no longer valid.
Thanks for any help!
|
|
|
|
|
|
|
Hi all,
I have some code that uses RAS/DUN connections, and I am also using code that uses RegisterDeviceNoticication(). In order to use the API UnregisterDeviceNotification() to close the handle returned by the first function, WINVER must be defined as 0x0500 or greater. After doing this, my RAS functions return error 632 -- "An incorrect structure size was detected."
Specifically, I'm getting this error when trying to use RasGetEntryProperties get get info into a RASENTRY struct.
What's the deal here?
I'm using WinXP, & MS VC++ 6.0 w/ SP 6 installed.
How can I fix this?
|
|
|
|
|
Hi,
I want to print a chart, that is drawn in a dialog. I have no idea how to do that. should i use the function Print?
thanks in advance
|
|
|
|
|
|
What would the following conditional (i+n) in a for loop evaluate to?
for (i=0; i + n; i--)
I saw it once, but I dont understand what was happening.
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
0 if n starts at 0. Otherwise non-zero, thus the for loop would never terminate.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I want to believe you, but I cannot.
int k = 0;
int i, n=100;
for (i=0; i + n; i--)
k++;
When this is done, k will equal 100. Can you explain?
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
The for test is:
i + n
which is the same as:
i + n != 0
n = 100 so we can rewrite as:
i + 100 != 0
or (subtract 100 from both sides),
i != -100
so as i starts at 0 and decrements by 1 on each iteration it will loop 100 times.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
It helps to show all of the code up front. Since n starts out as 100 , rather than 0 as I initially presumed, i + n will eventually evaluate to 0 which will terminate the loop.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|