|
What are the values and contents of lpszName and lpszConnect?
Mark
This episode brought to you by the number 5
|
|
|
|
|
lpszName the path of the mdb file is displayed and the lpszConnect stores 0.
Ansh
|
|
|
|
|
aaaan wrote: and the lpszConnect stores 0
I'm not sure a NULL pointer is allowed there.
Instead of 0, try passing _T("")
Mark
This episode brought to you by the number 5
|
|
|
|
|
I have a buffer of LPBYTE type. How can I generate JPEG file from this bufer?
Mainly I need the information that must be written to the JPEG file.
|
|
|
|
|
What is the format of the data in your buffer? If it's already a JPG file you simply need to write out its contents. If it's not already a JPG you'll need to convert it. You haven't given enough information for more detailed instructions.
Steve
|
|
|
|
|
I have no JPEG image. I want to create a new JPEG image.
I have a buffer containing core data.
/// Code
LPBYTE m_pPhotoBuffer;
m_pPhotoBuffer = new BYTE[height*width*3];
memcpy(m_pPhotoBuffer,(LPBYTE)lParam, height*width*3);
////
Now I have a camera recieved data in m_pPhotoBuffer.
I want to create a fresh JPEG file from this data.
|
|
|
|
|
|
Please refer here[^] for more information on JPEG.
As I understand that you received input bytes from camera, so it must be raw bytes that is pixel data (Red, Green and Blue). As JPEG file format is the compressed file format, you first need to compress your data with JPEG standard.
Regards,
Paresh.
|
|
|
|
|
Hello,
In my one-doc/multi-view program, one of the views is the print preview view. Normally, it will response to the user's Esc stroke, I want to disable this behavior. How should I do?
Thanks in advance.
Max
|
|
|
|
|
|
also u can use your own printprew.i've seen the CView::OnFilePrintPreview() which is not complicable.
|
|
|
|
|
I'm not familiar with hook technics. Would you please give me more details,
or, if possible, a sample program or a segment of code show this method?
Thanks for your help.
Max
|
|
|
|
|
For instance, you can override PreTranslateMessage method.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks for your help.
I overrided the view's PreTranslateMessage() method, But unfortunately I found the printpreview disappears immediately after I pressed the Esc key before I can deal with the msg in the override.
Max
|
|
|
|
|
Using the SPY++ utility, I found the view has not even received any message except mouse msg's, e.g. mouse move, click, etc..
Then my override of PreTranslateMessage() will have no chance to paly any magic.
Thanks anyway.
Max
|
|
|
|
|
I'm subclassing TrayClockWClass on Win2K3 using a DLL hook. If I use an ANSI build of the DLL, the hook works with no problem. If I use a Unicode build of the DLL, I get a "The instruction at '0x00000000' referenced memory at '0x00000000'. The memory could not be 'read'." error in explorer.exe. When I click OK on the error dialog explorer.exe restarts and for an instant I can see my subclassed window instead of the normal clock.
I've placed some logging statements in the code. SetWindowLong() is successful. And my new WndProc() is being called multiple times with valid values. But it crashes for a reason I cannot determine. The last entry in my log is for a window message that was handled successfully multiple times.
And the weirdest thing is that TrayClockWClass is a Unicode window, so I figure it would get along with a Unicode DLL. I only plan to use the code on WinXP and Win2K3 so I'd rather use native Unicode rather than a thunked ANSI DLL.
Has anyone had any experience with ANSI hooks working, but Unicode hooks not working? Or any clues as to debugging what the problem is? If you want to take a look at the source code, a Visual Studio 2005 solution is in a Subversion repository (http://fuzzyclock.googlecode.com/svn/trunk/ fuzzyclock).
|
|
|
|
|
I don't know if this is relevant or helps in any way, but...
Testing on XP Pro SP2, Unicode DLL build:
During the SetWindowsHookEx() call, I get a "Data Execution Prevention" dialog with the message
"To help protect your computer, Windows has closed this program"
HookProc() is never callled.
Non-Unicode build runs fine.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
If I run the release Unicode build on XP Pro SP2, I get an unhandled exception in explorer.exe. But the log file I create (c:\log.txt) has output from HookProc():
SetWindowLong() returns 1001b1f. NewWndProc is c412e0. Thanks for taking a look. I guess I'll just stick with the ANSI build.
-- modified at 16:01 Sunday 22nd July, 2007
HookProc() needs to be _stdcall . Once I did that, the Unicode build worked.
|
|
|
|
|
Can someone tell me how big the BLUETOOTH_RADIO_INFO struct is? I believe it's 272. I'm trying to convert this into C# and I need to know the size...
typedef struct {<br />
DWORD dwSize;<br />
BLUETOOTH_ADDRESS address;<br />
WCHAR szName[BLUETOOTH_MAX_NAME_SIZE];<br />
ULONG ulClassofDevice;<br />
USHORT lmpSubversion;<br />
USHORT manufacturer;<br />
} BLUETOOTH_RADIO_INFO;<br />
<br />
typedef struct _BLUETOOTH_ADDRESS {<br />
union {<br />
BTH_ADDR ullLong;<br />
BYTE rgBytes[6];<br />
};<br />
} BLUETOOTH_ADDRESS;<br />
<br />
typedef ULONGLONG BTH_ADDR;<br />
#define BLUETOOTH_MAX_NAME_SIZE (248)<br />
<br />
|
|
|
|
|
Using the information you gave, using default packing [8] and using sizeof(), I come up with 520.
(I confirmed this compiling against the Windows Server 2003 R2 Platform SDK)
(Note that szName is WCHAR, so it has to be at last 496.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
sizeof(BLUETOOTH_ADDRESS) == 8
sizeof(BLUETOOTH_RADIO_INFO) == 520
As Joe mentioned, if you'll be passing between C++ and C#, make sure packing/alignment are the
same on both platforms.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
class Car<br />
{<br />
public:<br />
virtual ~Car() {delete itsCarb;}<br />
private:<br />
Carburetor* itsCarb<br />
};
Why is the destructor virtual here?
|
|
|
|
|
class FastCar : public Car
{
public:
virtual ~FastCar() { delete itsTurbo; }
private:
Turbo* itsTurbo;
}
FastCar* ferrari = new FastCar();
Car* car = ferrari;
delete car;
I think without the virtual destructor, FastCar's destructor would never get called if it's deleted using a pointer to a base class.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Car should have the virtual destructor. It doesn't matter if FastCar has one or not, unless you plan to extend that too.
|
|
|
|
|
True, but I was planning on writing a ReallyFastCar!
- S
50 cups of coffee and you know it's on!
|
|
|
|