|
|
Most wrappers would just wrap zlib, which doesn't have unicode support. It's not particularly difficult to change fopen to _tfopen, char* to TCHAR* etc, just have to watch out when you allocate space for strings to * sizeof(TCHAR). Tedious though as zlib seems to have lots of unnecessary casts but it shouldn't take more than an hour of your time. I just modded a copy and it seems fine.
|
|
|
|
|
Thanks for the input...
It's all a big hairball, I have to say.
For various reasons, I ended up using the code from the zlib website.
http://www.zlib.net/zlib_how.html[^]
CGZip was a mess, and it's sample program kept getting stack overflows. (no time to deal with that)
The only other messy part -- was trying to get the code to spit out a gzip header instead of a zlib header. I was trying to get it to work with GZIPInputStream...
Anyhow, thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Hi,
I had got an error as "Invalid handle specified" while trying write to a serial port(COM1)using WriteFile().
But the handle to serial port is seems to be valid.
One by one step I had followed is below.
Step 1: Create a connection
HANDLE hSerial = CreateFile( "COM1",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL ,NULL);
Step 2: Configure the settings
DCB db;
memset( &db,0,sizeof(db));
db.DCBlength = sizeof(db);
if( ! GetCommState( hSerial, &db ))
{
return;
}
if( ! SetCommState( hSerial, &db ) )
{
DWORD dw = GetLastError();
return;
}
Step 3:
DWORD dwWritten;
OVERLAPPED or;
if( WriteFile( hSerial, "Write", 6, &dwWritten, &or ))
{
AfxMessageBox( "Write Success!!!");
}
Step1 and Step2 are successfully executed.
But step3 returns an "Invalid handle specified" error.
What may be prob?
Thanx in Advance.
-- modified at 0:33 Friday 11th August, 2006
|
|
|
|
|
What is the value of hSerial at this point (check with your debugger) ? It should be something else than 0xFFFFFFFF
|
|
|
|
|
Try to zero out or before using it.
ZeroMemory(&or, sizeof(OVERLAPPED));
Then set the hEvent member to your handle (hSerial).
Or an easier way: Use a ready made serial communication class. There are quite a few here at CP.
-- modified at 3:15 Friday 11th August, 2006
|
|
|
|
|
oops!
That was the problem.
Thanx you very much.
|
|
|
|
|
I'm glad to help you.
But i would suggest you to use a ready-made serial comms class. It's not easy to handle two different overlapped structures (one for read, one for write).
And if you don't use overlapped, then your reads will hang until there is data to read.
A serial comms class will take care of that problem for you.
|
|
|
|
|
I decided to use non-overlapped communication.
I had made a worker thread for reading the serial port hoping that the blocking issue get solved.
But from the worker thread if I call ReadFile() using the same handle,
it do not wait, even if there is no data in the serial port.
why this happens?
Plz help..
-- modified at 7:04 Friday 11th August, 2006
|
|
|
|
|
Well, I'm not sure what happens.
My suggestion is to read about ReadFile at MSDN.
Or, as I said before... Use a ready-made serial comms class...
That way, you won't have to reinvent the wheel.
Serial comms ain't easy to handle.
I'm leaving for the weekend now.
|
|
|
|
|
I use a pop up window to display the flash. when i close the pop up window, the flash haven't stoped. how can i stop the flash?
I try to use CDialog::OnDestroy(); but i can't work
-- modified at 23:33 Thursday 10th August, 2006
|
|
|
|
|
call EndDialog(1);
or Send api for postquitmessage(...)
|
|
|
|
|
Do you have any code for close popup window?
|
|
|
|
|
I want to set the window/dialog size by user controling the mouse not by the program. Any setting needed in the dialog properties? Thx
|
|
|
|
|
Take the Dialog properties
Set Styles > Border > Resizing
Regard's
Dhana
|
|
|
|
|
Is WS_THICKFRAME your intend or no?
|
|
|
|
|
Hi,
I am a c# programmer and I am trying to reference a DLL wriiten in c++. I receive an error stating that it is not a valid assembly or COM component. I also have the source code, so I am attempting to compile it in Visual Studio 2005. It was originally compiled in Visual c++ 6 I believe. It is my understanding that if I can complie the DLL in the new framework, I can then reference the DLL in c#.
So, when I attempt the compilation I get a number of errors which I am hoping can be solved.
<b>Error c2011 'struct' type redefinition. </b>
This error is in an .h file which has a message at the top:
Machine generated IDispatch wrapper class(es) created with ClassWizard
This errors occurs in a line
<code>class Font : public COleDispatchDriver
{</code>
COleDispatchDriver is a class in a .h file which states
that this is a part of the MFC Classes c++ library.
<b>Error c4430 missing type specifier - int assumed </b>
This error is on a line which calls a routine called debugEMF()
If I goto this routine it is
<code>CEnhancedMetaFile::debugEMF()</code>
CEnhancedMetaFile is a class
Pls forgive me: I have no idea about c++.
Anyone help pls?
alias47
|
|
|
|
|
alias47 wrote: I receive an error stating that it is not a valid assembly or COM component
If it's a COM component, then it needs to be registered. Are you sure it's a COM component ? If it's just a dll, you need to use p/invoke to call it.
alias47 wrote: It was originally compiled in Visual c++ 6 I believe.
OK, VC6 is rubbish, that's probably where you're getting errors.
alias47 wrote: Machine generated IDispatch wrapper class(es) created with ClassWizard
OK, it's a COM dll then. What is the struct ?
alias47 wrote: Error c4430 missing type specifier - int assumed
In VC6, you could not specify a return type and it would just be int. This is bad, and VC2005 does not allow it. Turn
CEnhancedMetaFile::debugEMF()
into
int CEnhancedMetaFile::debugEMF()
and that should compile.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi friends,
I want to write a visualization plug-in for windows media player and I really wonder what is the best approach with regard to performance:
1. is it DDBs??
2. DIBs?
3. OpenGL?
4. DirectX?
or maybe other??
plz provide me with ur advice.
Thank you,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
DDBs are perhaps going to perform better because they are matched to the device, a DIB has it's own bit depth. Windows is also geared more towards DDBs, although personally I prefer to use DIBSections as they give me access to the underlying bits as well
The trouble with using OpenGL or DirectX is that you need them installed first. DX is a safer bet. Obviously, these frameworks exist because doing 3D with straight GDI or GDI+ is not very performant.
DirectX would be my pick for performance.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you for your help,
but, does it make any difference when it is developed for PocketPC devices?
Thanks in advance
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Only if DX or OGL are not available on the PPC
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I posted a Q about memory leak and got suggestion to use the tool:
Visual Leak Detector
I linked all as instruction and run in debug, but I see Nothing related to the tool, it looks that the tool doesn't exist:
No interface, no text, no god, no ghost, no ...
every thing is exactly the same as before.
what is that? have u used the tool in someway?
I think I should see something about the tool.
any comments?
-- modified at 15:56 Thursday 10th August, 2006
|
|
|
|
|
why don't you ask your question in the comments of the article of Visual Leak Detector ?
|
|
|
|
|
includeh10 wrote: I think I should see something about the tool.
What?
includeh10 wrote: any comments?
Yes. Why did you start another thread for the same question?
led mike
|
|
|
|