|
I might be wrong but as far as i know when you grab the window or size it, an "internal message loop" starts (probably it's somewhere inside one of the system DLLs, just a guess too) that handles the move/size operation, filters out some messages and lets others reach your window(s).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Is their any application that can retrieve class names for running Windows.
|
|
|
|
|
|
|
Hi,
While performing the print operation my application is crashing(only some times).
In logs i have found the following error:
Violation address: 0x7c93426d
Exception code: 3221225477
Description: EXCEPTION_ACCESS_VIOLATION: The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
Access violation error at READING from 0x0.
Can somebody suggest me what may be the possible cause of error.
|
|
|
|
|
Why don't you use the debugger to find the offending line?
Have you more detailed info coming from the log file?
With the info you provided it is really hard guessing the reason of the error.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Actually in my system it is not crashing.
The logs i got from the client machine.
I checked on the net and got the clue that it may the problem with installed drivers.
|
|
|
|
|
Actually at one place i am using the follwing code and dcRef is NULL in my case so it is going to the else part.
mDC = new CMetaFileDC();
if (mDC != 0)
{
HDC myhdl;
if (dcRef != 0)
{
myhdl = dcRef->m_hAttribDC;
}
else
{
myhdl = getDC();
dcRef = CDC::FromHandle(myhdl);
}
mDC->CreateEnhanced(dcRef, 0, bounds, description);
mDC->SetAttribDC(myhdl);
mDC->SetMapMode(MM_HIMETRIC);
}<pre>
Is there any problem in passing a pointer acquired from CDC::FromHandle to CreateEnhanced.
At some other place i am using
<pre>mMetaFileHandle = mDC->CloseEnhanced();
delete mDC;
mDC = 0;
do something .....
if (mMetaFileHandle != 0)
{
::DeleteEnhMetaFile(mMetaFileHandle);
mMetaFileHandle = 0;
}
HDC myhdl = getDC();
CDC dc;
dc.Attach(myhdl);
dc.DeleteDC();
In the above code getDC is returning a handle to the device context.
|
|
|
|
|
Hi every one.
I'm tring to save IHTMLElement which has IMG tag to hard drive. I'm not tring to save the entire web page as image. NO. I'm tring to save single image (IHTMLElement of Tag IMG) to hard drive.
I tried IHTMLElementRender::DrawToDC(), but it works only if the IHTMLElement size is less than the physical size of my computer screen. If the IHTMLElement (the single image or picture) size is larger than my computer's screen, the function ( DrawToDC() ) draws partial image.
Any help????????
Thanks
|
|
|
|
|
|
Thanks for replaying. But the thing is I do not want to download the image again. IWebBrowser control downloaded the image already. I want to save form IWebBrowser not download it from internet again.
|
|
|
|
|
Hi all ,
Outlookbar-style menu interface[^]
i m using this code ,i want to display Infotip or Tooltip for Items and Subitems,because some of my Items and subitems are long so they are not properly disaplay here.
so i want to use Infotip or Tooltip for Items and Subitems ,to display full text of items and subitems on mouse move.
if number of subitems are large so some items might disappear ,so i want to insert vertical scrollbar it this situation.
please help me for this.
thanks in advance.
modified on Saturday, July 10, 2010 5:19 AM
|
|
|
|
|
Hi sir,
I am not able to open the dialog.
Its showing the error as.
"C:\DataBase\Sample.MDB" is not a valid path.Make sure that the path name is spelled correctly and that you are connected to the server on which the field resides.
void CMainView::OnAdminlist()
{
AdminList.DoModal();
}
When i go into that function,i am getting error as
i.e \MFC\SRC\DLGCORE.cpp
TRY
{
AfxHookWindowCreate(this);
Brekpoint error---------> if (CreateDlgIndirect(lpDialogTemplate,
CWnd::FromHandle(hWndParent), hInst))
{
if (m_nFlags & WF_CONTINUEMODAL)
{
DWORD dwFlags = MLF_SHOWONIDLE;
if (GetStyle() & DS_NOIDLEMSG)
dwFlags |= MLF_NOIDLEMSG;
VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
}
if (m_hWnd != NULL)
SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
CATCH_ALL(e)
{
DELETE_EXCEPTION(e);
m_nModalResult = -1;
}
END_CATCH_ALL
Actually first the application was in MS-Access DatBase.I changed it to SQL.
Now i am not getting what is this error.
Note : nd one more thing is
If i am trying to open the application for the first time(If the DataBase which is created with MSAccess) name is changed
For ex: I rename the database from"DatBase" to "DataBase1"
I am getting the error message before opening the application.
>"C:\DataBase\Sample.MDB" is not a valid path.Make sure that the path name is spelled correctly and that you are connected to the server on which the field resides.
If i dnt change the DataBase name i am not getting this error message when i open the application
Where may be the problem
Any idea will be helpful
Thanks
Raj
modified on Saturday, July 10, 2010 12:43 AM
|
|
|
|
|
You seem to be getting confused between two different errors.
1. If your path to the database file is not correct you will get the errors above. The error message could not be more clear as to the cause of the problem, the solution is simply to ensure that the file exists and the path in your program is correct.
2. AdminList.DoModal(); is giving an error trying to create a modeless dialog. This does not make much sense since a call to DoModal(); should show a modal dialog. However the information you provided does not show how AdminList has been created.
It's time for a new signature.
|
|
|
|
|
My application used the Grid Control[^] to show the data from database. Some of these field need to show in Thai language text but it become to unreadable text.
Normally, The Thai text can show in this Grid and this application already used for 1 year in the hotel reception computer with have no such problem.
Recently, many customers' hotel ask for use this computer for send the e-mail, so each person will set up some windows setting for make it support to they own language such as Japanese, Chinese etc.
In this point, it is the root cause of the problem that make the Thai language text can not show in the Grid control again.
The problem only happen in this application for another application such as Word, Notepad etc. It still can show the Thai text normally.
Please, anybody help me to solve this problem.
Note:
The application write by MFC from VS2005 and run on windows XP profressional SP3
|
|
|
|
|
having a quick look at the Grid Control, I see it does have Unicode support - but maybe you have to enable it ?
'g'
|
|
|
|
|
I've never used GDI in any of my projects.
But had some programming introduction to it.
Since I've been using Windows 7, I'm trying to build a new project with Direct2D.
It compiles and runs, but it doesn't display anything!
Does anyone have any experience, what could be the reason?
#include <Windows.h>
#include <d2d1.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hCurrInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS SetFileTime = {};
SetFileTime.hInstance = hCurrInstance;
SetFileTime.lpfnWndProc = WndProc;
SetFileTime.lpszClassName = L"D2D";
RegisterClass(&SetFileTime);
CreateWindow(
L"D2D",
L"Direct2D",
WS_OVERLAPPEDWINDOW|WS_VISIBLE,
100, 100, 800, 600,
NULL,
NULL,
hCurrInstance,
NULL);
MSG WindowMessages = { };
while (GetMessage(&WindowMessages, NULL, 0, 0))
{
TranslateMessage(&WindowMessages);
DispatchMessage(&WindowMessages);
}
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CREATE:
{
ID2D1Factory* pD2DFactory = NULL;
D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, &pD2DFactory);
RECT rc;
GetClientRect(hwnd, &rc);
ID2D1HwndRenderTarget* pRT = NULL;
pD2DFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(),
D2D1::HwndRenderTargetProperties(hwnd, D2D1::SizeU( rc.right - rc.left, rc.bottom - rc.top)),
&pRT);
ID2D1SolidColorBrush* m_pLightSlateGrayBrush = NULL;
pRT->CreateSolidColorBrush( D2D1::ColorF(D2D1::ColorF::LightSlateGray), &m_pLightSlateGrayBrush);
D2D_RECT_F OriginalRect;
OriginalRect.left = 10.f;
OriginalRect.top = 10.f;
OriginalRect.bottom = 100.f;
OriginalRect.right = 100.f;
D2D1_ROUNDED_RECT RoundedRect;
RoundedRect.rect = OriginalRect;
RoundedRect.radiusX = 1.0f;
RoundedRect.radiusY = 1.0f;
ID2D1RoundedRectangleGeometry* Card = NULL;
pD2DFactory->CreateRoundedRectangleGeometry(RoundedRect, &Card);
pRT->BeginDraw();
pRT->FillRoundedRectangle(&RoundedRect, m_pLightSlateGrayBrush);
pRT->DrawRoundedRectangle(&RoundedRect, m_pLightSlateGrayBrush);
pRT->EndDraw();
return 0;
}
case WM_CLOSE:
{
DestroyWindow(hwnd);
return 0;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
|
|
|
|
|
You don't handle the WM_PAINT message, in which all the drawing code should be put. You have put everything in WM_CREATE, which is called when the window is being created.
I suggest you read the following article[^] to get a basic understanding of how it works.
|
|
|
|
|
Hi
I am in the process of learning FIX protocol using QuickFix, I am following the example which is given in the documentation,however I am getting an error during build in one file which is part of the quickfix header file.
Can anyone please let me know if I am missing anything in my project configuration. Just as an FYI I did follow all the instruction in quickfix website to set up a C++ project.
Regards
Arup
Error:
---------------------
<br />
1>c:\project\quickfix\quickfix_c\quickfix\include\quickfix\exceptions.h(260) : error C2664: 'FormatMessageW' : cannot convert parameter 5 from 'char [2048]' to 'LPWSTR'<br />
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
Code of Exceptions.h. The error is in line 260 which is as follows:
<br />
#ifdef _MSC_VER<br />
error = WSAGetLastError();<br />
char buffer[2048];<br />
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),<br />
buffer, 2048, NULL );<br />
return buffer;<br />
#else<br />
Exceptions.h
-------------------------
<br />
<br />
<br />
<br />
<br />
#ifndef FIX_EXCEPTIONS_H<br />
#define FIX_EXCEPTIONS_H<br />
<br />
#include <string><br />
#include <stdexcept><br />
#include "Utility.h"<br />
<br />
namespace FIX<br />
{<br />
<br />
struct Exception : public std::logic_error<br />
{<br />
Exception( const std::string& t, const std::string& d )<br />
: std::logic_error( d.size() ? t + ": " + d : t ),<br />
type( t ), detail( d )<br />
{}<br />
~Exception() throw() {}<br />
<br />
std::string type;<br />
std::string detail;<br />
};<br />
<br />
struct DataDictionaryNotFound : public Exception<br />
{<br />
DataDictionaryNotFound( const std::string& v, const std::string& what = "" )<br />
: Exception( "Could not find data dictionary", what ),<br />
version( v ) {}<br />
~DataDictionaryNotFound() throw() {}<br />
<br />
std::string version;<br />
};<br />
<br />
struct FieldNotFound : public Exception<br />
{<br />
FieldNotFound( int f = 0, const std::string& what = "" )<br />
: Exception( "Field not found", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct FieldConvertError : public Exception<br />
{<br />
FieldConvertError( const std::string& what = "" )<br />
: Exception( "Could not convert field", what ) {}<br />
};<br />
<br />
struct MessageParseError : public Exception<br />
{<br />
MessageParseError( const std::string& what = "" )<br />
: Exception( "Could not parse message", what ) {}<br />
};<br />
<br />
struct InvalidMessage : public Exception<br />
{<br />
InvalidMessage( const std::string& what = "" )<br />
: Exception( "Invalid message", what ) {}<br />
};<br />
<br />
struct ConfigError : public Exception<br />
{<br />
ConfigError( const std::string& what = "" )<br />
: Exception( "Configuration failed", what ) {}<br />
};<br />
<br />
struct RuntimeError : public Exception<br />
{<br />
RuntimeError( const std::string& what = "" )<br />
: Exception( "Runtime error", what ) {}<br />
};<br />
<br />
struct InvalidTagNumber : public Exception<br />
{<br />
InvalidTagNumber( int f = 0, const std::string& what = "" )<br />
: Exception( "Invalid tag number", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct RequiredTagMissing : public Exception<br />
{<br />
RequiredTagMissing( int f = 0, const std::string& what = "" )<br />
: Exception( "Required tag missing", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct TagNotDefinedForMessage : public Exception<br />
{<br />
TagNotDefinedForMessage( int f = 0, const std::string& what = "" )<br />
: Exception( "Tag not defined for this message type", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct NoTagValue : public Exception<br />
{<br />
NoTagValue( int f = 0, const std::string& what = "" )<br />
: Exception( "Tag specified without a value", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct IncorrectTagValue : public Exception<br />
{<br />
IncorrectTagValue( int f = 0, const std::string& what = "" )<br />
: Exception( "Value is incorrect (out of range) for this tag", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct IncorrectDataFormat : public Exception<br />
{<br />
IncorrectDataFormat( int f = 0, const std::string& what = "" )<br />
: Exception( "Incorrect data format for value", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct IncorrectMessageStructure : public Exception<br />
{<br />
IncorrectMessageStructure( const std::string& what = "" )<br />
: Exception( "Incorrect message structure", what ) {}<br />
};<br />
<br />
struct DuplicateFieldNumber : public Exception<br />
{<br />
DuplicateFieldNumber( const std::string& what = "" )<br />
: Exception( "Duplicate field number", what ) {}<br />
};<br />
<br />
struct InvalidMessageType : public Exception<br />
{<br />
InvalidMessageType( const std::string& what = "" )<br />
: Exception( "Invalid Message Type", what ) {}<br />
};<br />
<br />
struct UnsupportedMessageType : public Exception<br />
{<br />
UnsupportedMessageType( const std::string& what = "" )<br />
: Exception( "Unsupported Message Type", what ) {}<br />
};<br />
<br />
struct UnsupportedVersion : public Exception<br />
{<br />
UnsupportedVersion( const std::string& what = "" )<br />
: Exception( "Unsupported Version", what ) {}<br />
};<br />
<br />
struct TagOutOfOrder : public Exception<br />
{<br />
TagOutOfOrder( int f = 0, const std::string& what = "" )<br />
: Exception( "Tag specified out of required order", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct RepeatedTag : public Exception<br />
{<br />
RepeatedTag( int f = 0, const std::string& what = "" )<br />
: Exception( "Repeated tag not part of repeating group", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct RepeatingGroupCountMismatch : public Exception<br />
{<br />
RepeatingGroupCountMismatch( int f = 0, const std::string& what = "" )<br />
: Exception( "Repeating group count mismatch", what ),<br />
field( f ) {}<br />
int field;<br />
};<br />
<br />
struct DoNotSend : public Exception<br />
{<br />
DoNotSend( const std::string& what = "" )<br />
: Exception( "Do Not Send Message", what ) {}<br />
};<br />
<br />
struct RejectLogon : public Exception<br />
{<br />
RejectLogon( const std::string& what = "" )<br />
: Exception( "Rejected Logon Attempt", what ) {}<br />
};<br />
<br />
struct SessionNotFound : public Exception<br />
{<br />
SessionNotFound( const std::string& what = "" )<br />
: Exception( "Session Not Found", what ) {}<br />
};<br />
<br />
struct IOException : public Exception<br />
{<br />
IOException( const std::string& what = "" )<br />
: Exception( "IO Error", what ) {}<br />
};<br />
<br />
struct SocketException : public Exception<br />
{<br />
SocketException()<br />
: Exception( "Socket Error", errorToWhat() ) {}<br />
<br />
SocketException( const std::string& what )<br />
: Exception( "Socket Error", what ) {}<br />
<br />
std::string errorToWhat()<br />
{<br />
#ifdef _MSC_VER<br />
error = WSAGetLastError();<br />
char buffer[2048];<br />
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),<br />
buffer, 2048, NULL );<br />
return buffer;<br />
#else<br />
error = errno;<br />
return strerror( error );<br />
#endif<br />
}<br />
<br />
int error;<br />
};<br />
<br />
struct SocketSendFailed : public SocketException<br />
{<br />
SocketSendFailed() {}<br />
SocketSendFailed( const std::string& what )<br />
: SocketException( what ) {}<br />
};<br />
<br />
struct SocketRecvFailed : public SocketException<br />
{<br />
SocketRecvFailed( int size )<br />
: SocketException( size == 0 ? "Connection reset by peer." : size < 0 ? errorToWhat() : "Success." ) {}<br />
SocketRecvFailed( const std::string& what )<br />
: SocketException( what ) {}<br />
};<br />
<br />
struct SocketCloseFailed : public SocketException<br />
{<br />
SocketCloseFailed() {}<br />
SocketCloseFailed( const std::string& what )<br />
: SocketException( what ) {}<br />
};<br />
<br />
<br />
}<br />
<br />
#endif //FIX_EXCEPTIONS_H<br />
<br />
|
|
|
|
|
The posting of all that code was unnecessary. You simply have a Unicode issue. See here for more.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
The important bit is the error message:
"c:\project\quickfix\quickfix_c\quickfix\include\quickfix\exceptions.h(260) : error C2664: 'FormatMessageW' : cannot convert parameter 5 from 'char [2048]' to 'LPWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast"
It looks like you're compiling your code with _UNICODE defined. When that happens FormatMessage gets replaced by FormatMessageW which expects it's parameters to be wide characters. As rest of the code seems to be assuming that they're using narrow characters there's a type mismatch.
If Visual Studio check that for the project you've selected "use multi-byte character set" rather than "use unicode character set" and the problem will go away. You might like to also contact the programmers that maintain the library you're using and suggest they document the problem (or switch their code to use wide characters as narrow ones have been dead on Windows for some time now).
Cheers,
Ash
|
|
|
|
|
Please mark this code as Resolved. I would like to thank all for helping me out.
|
|
|
|
|
Hi,
I am getting the following error when I am building my project in Visual Studio 2005.
Error 134 error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CCancelUIThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' d:\CBSTellerLatest\IDManager\CancelThread.cpp 138
I am not getting any error when I runm the same code on Visual Studio 6.0
The Code is as Follows
Code in .H file
afx_msg LRESULT OnStepProgress(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
Code in .CPP file
BEGIN_MESSAGE_MAP(CCancelUIThread, CWinThread)
ON_MESSAGE(CM_PROGRESS_STEPIT, OnStepProgress)
ON_MESSAGE(CM_PROGRESS_SETTEXT, OnSetText)
END_MESSAGE_MAP()
And the function definations.
Please help me out.
Thanks In Advance
|
|
|
|
|
What is line 138?
Have you tried:
ON_MESSAGE(CM_PROGRESS_STEPIT, &CCancelUIThread::OnStepProgress)
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Ummm - a CWinThread is not a CWnd, so it can't have ON_MESSAGE handlers. It *can* have ON_THREAD_MESSAGE handlers, though…so use those instead...
The reason VC6 doesn't complain is that its compiler is so lax at checking and enforcing static typing rules. That's a bad thing, m'kay, 'cause it means there can be many latent, potential bugs left in your code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|