|
Hi!
I m working on a database project in which i use CDaoDatabase class of MFC
to create the connection with a Access .mdb file by using its open()
function. and then use CDaoQueryDef class to save the query in the database.
It works well when I run my program first time for a database but if I
select the another or same Access .mdb file without closing the exe of my project it give error in its open
function. the error msg is somthing like this-> Unhandled exception in
myProject.exe(DAO360.DLL):0xc0000005:Access violation.
Pls help me to solve this problem as early as possible.
Ansh
|
|
|
|
|
Maybe try wrapping methods that can throw exceptions in try/catch blocks.
Then you can get detailed error info.
try
{
...try database open
}
catch (CDaoException *e)
{
... examine exception/error info here
e->Delete();
}
*EDIT* Besides checking for exceptions - are the string pointers you pass to Open() valid?<br />
(Thanks Steve!)
Mark
-- modified at 1:41 Friday 6th July, 2007
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
It looks like the exception was an access violation and so your code will not catch it.
Steve
|
|
|
|
|
Thanks
Mark Salsbery
Microsoft MVP - Visual C++
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
i use try wrapping method bt it unale to track the error.
Acctually wn i debug my program and track all steps then i watch that wn the open function of CDaoDatabase class is called like this->
void CDaoDatabase::Open(LPCTSTR lpszName, BOOL bExclusive,
BOOL bReadOnly, LPCTSTR lpszConnect)
{
----
----
DAO_CHECK(m_pWorkspace->m_pDAOWorkspace->OpenDatabase(
V_BSTR(&var),
COleVariant((long)bExclusive, VT_BOOL),
COleVariant((long)bReadOnly, VT_BOOL),
COleVariant(lpszConnect, VT_BSTRT),
&m_pDAODatabase));
}
and wn the function DAO_CHECK is called it through the exceptions.
Ansh
|
|
|
|
|
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
|
|
|
|