|
|
Disable repainting while resizing.;)
Try this @ home. (B&B)
|
|
|
|
|
Could you tell me how to do this, I assume you are talking about situation where you only see the border of the window being moved and once you resized the window is painted again. This I would also like to do, plus, the same thing for moving a window, just the outline of it, then redraw.
|
|
|
|
|
You must proper handle the messages. For instance while resizing disable background painting. ( a Flag, reset after END resizing)
Read the posting and link above from "Rickard Andersson"
Try this @ home. (B&B)
|
|
|
|
|
I tried all of the above yet with no luck. Should I be disabling the background painting in the WM_PAINT message of WM_SIZE? If so what is the code for this? Maybe some code helps:
Here's my paint message:
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rectClient);
// Set Text Attributes
SetTextColor(hdc, RGB(0, 0, 225));
SetBkMode(hdc, TRANSPARENT);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
// Draw the Text
DrawText(hdc, szHeading, strlen(szHeading), &rectClient, DT_TOP |
DT_CENTER);
// Draw Horizontal Line
MoveToEx(hdc, 0, 35, NULL);
LineTo(hdc, rectClient.right, 35);
// Draw Vertical Line
MoveToEx(hdc, rectClient.right / 2, 35, NULL);
LineTo(hdc, rectClient.right / 2, rectClient.bottom - 100);
MoveToEx(hdc, 0, rectClient.bottom - 100, NULL);
LineTo(hdc, rectClient.right, rectClient.bottom - 100);
EndPaint(hwnd, &ps);
return 0;
And here is my sizing and colorlistbox message
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
MoveWindow(hwndLocalList, 5, 70, (cxClient / 2) - 10, cyClient - 165, FALSE);
MoveWindow(hwndHostList, (cxClient / 2) + 5, 70, (cxClient / 2) - 10,
cyClient - 165, FALSE);
return 0;
case WM_CTLCOLORLISTBOX:
SetTextColor( (HDC) wParam, RGB(255, 255, 255));
SetBkColor( (HDC) wParam, crBlue);
SelectObject( (HDC) wParam, GetStockObject(SYSTEM_FIXED_FONT));
return (LRESULT) hBlueBrush;
their wndclass.style is CS_VREDRAW | CS_HDREDRAW
Do you see what is wrong with the code?
|
|
|
|
|
WH_JOURNALRECORD and WH_JOURNALPLAYBACK
I try to use SetWindowsHookEx() and use two Hook type
WH_JOURNALRECORD and WH_JOURNALPLAYBACK to make
a capture and playback mechanism.
while on WH_JOURNALRECORD ,I store every messages that
the hookproc received,
and On WH_JOURNALPLAYBACK
I feed the messages I stored previously.
It seems works now,but still have some problems
while playback those messages.
1. it has TIME DELAY phenomena.
2. it has some messages lost phenomena.
the lost messages seems depends on system loading..
sometimes won't lost,but some times do if repeat playback
those messages recorded only once.
could someone have been done works like I do..??
any comment will be appreciate..
|
|
|
|
|
I have a dialog window with a CWebBrowser2 control on it, which I use to display a simple HTML report and allow it to be printed. I want the fact it is a web browser control to be transparent to the user, and therefore want to stop the IE menu from appearing when they right click on the control. Does anyone know where I can find code or an explaination on how to do this? I don't have much experience with ActiveX controls, and don't understand the explaination given to someone a while back.
|
|
|
|
|
there is an interface you can use IDocHostUIHandler
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
I am still a bit confused, I tried the following code:
CMyDialog::OnInitDialog()
{
...
DOCHOSTUIINFO *pInfo;
IDocHostUIHandler::GetHostInfo(pInfo);
pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU;
...
Am I using IDocHostUIHandler incorrectly? And I don't understand why I am getting undeclared variable errors?
|
|
|
|
|
|
Hi,
In my main application, i've created a thread which must send a message to a Document. Is this possible???
The ::Postmessage(...) work to send a message to a View (the first argument is a handle HWND)...
For the moment I send a message from this thread to the View and that work:
POSITION pos = GetFirstViewPosition();
HWND MyHwnd = (HWND) GetNextView(pos)->GetSafeHwnd();
DWORD error_flag = GetImage(m_pChannel, m_pImage, idcam);
::PostMessage(MyHwnd, WM_DISPLAYERRORMESSAGE, 0, (LPARAM) error_flag);
I want to send a message to the Document to simulate the use of a menu (e.i. "Stop" with the ID = ID_ACQUISITION_STOP)... How to do that...
Thanks in advance.
Hello World!!!
from Raphaël
|
|
|
|
|
Raphaël Kindt wrote:
Is this possible???
It's possible for WM_COMMAND , through the main frame. I have tried for user defined messages and it didn't work.
Anyway, i think the best method is the one you are currently using; it's strange to send messages to documents.
rechi
|
|
|
|
|
Hello everyone,
I am writing a server using winsock overlapped IO functions(WSASend, TransmitFile, and etc). I am wondering what situations will cause those operations exit without sending all packets.
Is is necessary to check the return value whenever an overlapped operation is completed to verify whether the those functions complete sending all data?
And where can I find some sample codes for server-side overlapped io operations?
thanks very much!
Kerry Chou
|
|
|
|
|
When the peer closes the socket prematurely; when a network error occurs; etc etc
#include <beer.h>
|
|
|
|
|
Hi!
I'm using owner draw buttons, and i have the need of making them disabled in some situations, i have this function:
void CMyButton::Activa(CWnd *pWnd, BOOL bEnable)
{
int iCtrl=0;
CString sTexto;
pWnd->EnableWindow(bEnable);
m_ToolTip.DelTool(pWnd, 0);
iCtrl=pWnd->GetDlgCtrlID();
pWnd->GetWindowText(sTexto);
}
This is called by the form class where the button is.
With pWnd i would also like to call its LPDRAWITEMSTRUCT, so i can call
void CMyButton::DrawButton(int nIDCtl, LPDRAWITEMSTRUCT pDI, CString sTexto)
and redesing the button for that situation, i'm not sure if this is the best solution for the propose but its the only i know!
Thank you for your time!
rui
|
|
|
|
|
How can i assign a value to the LPDRAWITEMSTRUCT struct parameters?
I tried :
void CMyButton::Activa(CWnd *pWnd, BOOL bEnable)
{
CRect rc;
pDIS->itemAction = ODA_DRAWENTIRE; <-error
pDIS->hwndItem = pWnd->GetSafeHwnd(); <-error
pDIS->hDC = (HDC)pWnd->GetDC(); <-error
pWnd->GetWindowRect(rc);
pDIS->rcItem = rc; <-error
CString sTexto;
//desactiva a o botao e os seus tooltips
pWnd->EnableWindow(bEnable);
m_ToolTip.DelTool(pWnd, 0);
//vai buscar ourtros dados do botao
iCtrl=pWnd->GetDlgCtrlID();
pWnd->GetWindowText(sTexto);
//passa o estado do botao para uma member variavel
bDisabled=bEnable;
DrawButton(iCtrl, pDIS, sTexto);
}
having
BOOL bDisabled;
int iCtrl;
LPDRAWITEMSTRUCT pDIS;
as member variables
Thank you
|
|
|
|
|
I am trying to create a pen in the following code:
LOGBRUSH logbr;
logbr.lbStyle = BS_SOLID;
logbr.lbColor = RGB(0, 0, 0);
logbr.lbHatch = 0;
if (MyPen.GetSafeHandle() == NULL)
MyPen.CreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbr);
CreatePen fails in Win98 and succeeds in other platforms. Does anyone know what is wrong in my code? I need your help.
Thank You
|
|
|
|
|
It seems that W98 is not supporting this feature. Step in the CreatPen call and you will see it.
You should find another soultion for W98 machines.;)
Try this @ home. (B&B)
|
|
|
|
|
Hello!
I don't find a way to dock a bar on the bottom of the frame, above the statusbar.
I'd appriciate your help.
Guy.
|
|
|
|
|
Have you try this ?
In the OnCreate of the MainFrame:
if(!m_MyBar.Create(...)){
return -1; // fail to create
}
m_MyBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_MyLogBar, AFX_IDW_DOCKBAR_BOTTOM);
HTH,
A rock pile ceases to be a rock pile the moment a single man contemplates it, bearing within him the image of a Cathedral[^].
Antoine de Saint-Exupery (1900-1944)
|
|
|
|
|
Yes I did, the problem is that the statusbar is bing positioned above the docked bar and it looks ugly as interface. it might be because of the indicators of the statusbar because in other programs I created in the past this problem didn't occur. thanks for the help anyway, and I'll be glad for new ideas
|
|
|
|
|
Do you create your status bar before your dialog bar ?
A rock pile ceases to be a rock pile the moment a single man contemplates it, bearing within him the image of a Cathedral[^].
Antoine de Saint-Exupery (1900-1944)
|
|
|
|
|
I keep getting an unknown runtime error 3705 or 0x0800A0E79 when I tried to open the recordset.
I tried look them up with VC's "Error Lookup". It says "Message Not Found"...
// ADOSchema.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define INITGUID
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename_namespace("ADOCG") rename("EOF", "EndOfFile")
using namespace ADOCG;
#include "icrsint.h"
void DisplayHR(HRESULT hr, char * lpszErrorMsg)
{
int nCode = -1;
cout << endl;
cout << "ERROR MSG: " << lpszErrorMsg << endl;
nCode = SUCCEEDED(hr);
cout << "SUCCEEDED(hr) = " << nCode << endl;
nCode = HRESULT_SEVERITY(hr);
cout << "HRESULT_SEVERITY(hr) = " << nCode << endl;
nCode = HRESULT_CODE(hr);
cout << "HRESULT_CODE(hr) = " << nCode << endl;
return;
}
int main(int argc, char* argv[])
{
HRESULT hr;
char * pszErrorMsg = NULL;
char * pszTableName = NULL;
char ** pTableArray = NULL;
int nMaxTableNameLength = -1;
int nNumUserTable = -1;
::CoInitialize(NULL);
pszErrorMsg = new char[100];
//STEP 1: Connection object
_ConnectionPtr pConn = NULL;
hr = pConn.CreateInstance( __uuidof(Connection) );
if(hr!=S_OK)
{
//Additional error handling here.
:isplayHR(hr, "ERROR: failed to instantiate connection pointer");
return 1;
}
//Data Source=norm OR 127.0.0.1 (It doesnt matter, it's the default instance)
hr = pConn->Open(L"Provider=sqloledb; Data Source=127.0.0.1; Initial Catalog=realtime", L"sa", L"sa", NULL);
if(hr!=S_OK)
{
//Additional error handling here.
:isplayHR(hr, "ERROR: failed to establish connection with target database");
return 1;
}
//STEP 2: Command object.
_CommandPtr pCmd;
pCmd.CreateInstance( __uuidof(Command) );
pCmd->ActiveConnection = pConn;
pCmd->CommandText = "SELECT * FROM sysobjects";
//STEP 3: Recordset - play with it.
_RecordsetPtr pRs;
try
{
pRs = pCmd->Execute(NULL, NULL, adCmdText);
}
catch(_com_error &e)
{
//Additional error handling here.
cout << "ERROR: Failed to execute command." << endl;
cout << "ERROR msg: " << e.ErrorMessage() << endl;
hr = e.Error();
cout << "ERROR: HRESULT_CODE( e.Error() ): " << HRESULT_CODE(hr) << endl;
return 1;
}
//Null variant:
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
try
{
//CursorType: adOpenForwardOnly; LockType: adLockReadOnly; Option: adCmdUnknown
pRs->Open(vNull, vNull, adOpenForwardOnly, adLockReadOnly, adCmdUnknown);
}
catch(_com_error &e) //QUESTION: Runtime error HERE!!! Cant figure out why!!
{
//Additional error handling here.
cout << "ERROR: Failed to open recordset." << endl;
cout << "ERROR: e.ErrorMessage(): " << e.ErrorMessage() << endl; //CAUTION: This turns out to be "Unknown error 0x800A0E79.
hr = e.Error();
cout << "ERROR: HRESULT_CODE( e.Error() ): " << HRESULT_CODE(hr) << endl; //CAUTION: And this turns out to be 3705.
return 1;
}
//STEP 4: Retrieve a list of user tables from sysobjects
nMaxTableNameLength = 100;
pszTableName = new char [nMaxTableNameLength];
pRs->MoveFirst();
while( !EOF )
{
hr = pRs->MoveNext();
if( hr!=S_OK)
{
//Additional error handling here!
DisplayHR(hr, "ERROR: MoveNext");
}
//If field=xType==1, Then the object is a user table. Increment nNumUserTable here.
}
//STEP 4: Get individual table properties: Field/data type/number of records/number of columns/PK-FK.
//STEP 5: Cleanup
delete [] pszTableName;
delete [] pszErrorMsg;
CoUninitialize();
return 0;
}
Can anyone spot the error? i'm dying...
norm
|
|
|
|
|
A quick search in google on 800A0E79 cam up with
Once you have called the Open method on an ADODB.RecordSet object, you must call the Close method before you can reuse it. Check for more than one Open using the same object name, or an Open in a loop without a matching Close
so you need to Close the pCmd object before you Open it again.
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
u're right, i:
pRs->Close
before I pRs->Open(...).
and it worked. all exception suddenly disappeared. The following line must have implicitly openned the recordset...
pRs = pCmd->Execute(NULL, NULL, adCmdText);
I still dont understand, i will search the error code on google and see if i can find a better explanation for this...
if "pRs = pCmd->Execute(NULL, NULL, adCmdText)" implicitly "open" the recordset, then why do we need to call pRs->Open(...)
norm
|
|
|
|
|