|
Hi,
Did you tried to redraw the bitmap window?
In your OnPaint() function try : m_BitmapWindow.RedrawWindow();
Regards,
Eli
|
|
|
|
|
I did not use OnPaint Function to create the bitmaps
I created a ShowBitmap(int x, int y, int type) function and some parameters for displaying the Bitmap, so what kind of other Functions would you recommend for me? Can UpdateWindows() be use?
|
|
|
|
|
I did not use OnPaint Function to create the bitmaps
I created a ShowBitmap(int x, int y, int type) function and some parameters for displaying the Bitmap, so what kind of other Functions would you recommend for me? Can UpdateWindows() be use?
|
|
|
|
|
Sorry what are the requirements i need to do before using this m_Bitmap.RedrawWindow();
Should i declare CDC m_Bitmap or CBitmap m_Bitmap?
|
|
|
|
|
Hi everybody, I am developing an Browser Helper Object. I want to get the data sent by the POST method on the NavigateComplete event. How can I do that? Hope to see your reply soon! Thanks.
|
|
|
|
|
Hello Everyone,
Can someone please tell a way to create tracking tooltip. Please note I have already tried the MSDN Libary tracking tooltips code, but failed to achieve the objective. Kindly help.
Regars
Ashwin
|
|
|
|
|
What was the problem with the MSDN code?
Medication for us all
You think you know me, well you're wrong
|
|
|
|
|
Hello Thanks for the Reply,
Have you tried the code. If so please paste your function here, I would be very much greatful to you. As far as my try goes I do get a tracking rectangle follwing my mouse but it keeps blinking all the time I move the mouse and without the text I pasted in the code.
bool g_bIsVisible;
HWND g_hwndTT;
void CTestDlg::TooltipFunc()
{
INITCOMMONCONTROLSEX icex;
HWND hwndTT;
TOOLINFO ti;
// Load the tooltip class from the DLL.
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_BAR_CLASSES;
if(!InitCommonControlsEx(&icex))
return NULL;
RECT rect;
GetClientRect (&rect);
// Create the tooltip control.
hwndTT = CreateWindow(TOOLTIPS_CLASS, TEXT(""),
WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, (HMENU)NULL, AfxGetApp()->m_hInstance,
NULL);
// Prepare TOOLINFO structure for use as tracking tooltip.
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE;
ti.hwnd = m_hWnd;
ti.uId = (UINT)m_hWnd;
ti.hinst = AfxGetApp()->m_hInstance;
ti.lpszText = "Hello World";
ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0;
// Add the tool to the control, displaying an error if needed.
if(!::SendMessage(hwndTT,TTM_ADDTOOL,0,(LPARAM)&ti)){
MessageBox("Couldn't create the tooltip control.",
"Error",MB_OK);
return NULL;
}
// Activate (display) the tracking tooltip. Then, set a global
// flag value to indicate that the tooltip is active, so other
// functions can check to see if it's visible.
::SendMessage(hwndTT,TTM_TRACKACTIVATE,(WPARAM)TRUE,(LPARAM)&ti);
g_bIsVisible = TRUE;
g_hwndTT = hwndTT;
}
void CTestDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(g_bIsVisible){
#define X_OFFSET 15
#define Y_OFFSET X_OFFSET
POINT m_point;
::GetCursorPos(&m_point);
::SendMessage(g_hwndTT,
TTM_TRACKPOSITION,
0,
(LPARAM)MAKELPARAM(m_point.x + X_OFFSET,
m_point.y + Y_OFFSET));
}
CDialog::OnMouseMove(nFlags, point);
}
BOOL CTestDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
LPNMTTDISPINFO lpnmtdi = (LPNMTTDISPINFO) lParam;
strcpy (lpnmtdi->szText, "Hello World");
return CDialog::OnNotify(wParam, lParam, pResult);
}
Regards
Ashwin
|
|
|
|
|
I am using following Code to Copy to Clip board.
This code is written under a button Copy ,
As i click on it first time it Works fine , and i can paste it in MS word.
As I clik 2nd time on Copy Botton . the Application Crashes down.
It crashes on statment pData->SetClipboard();
void CopyButton()
{
// Get DC
CDC* dcRef = GetDC();
tagSTGMEDIUM * data;
data = new tagSTGMEDIUM;
CMetaFileDC * dcMeta;
dcMeta = new CMetaFileDC();
if(!dcMeta)
{
AfxMessageBox("Unable to Load data on Clipboard");
return;
}
COleDataSource* pData = new COleDataSource;
//replace "ImageName" with a description of this image
dcMeta->CreateEnhanced(dcRef, NULL, NULL,"Cca-Graph" );
dcMeta->SetMapMode(MM_TEXT);
dcMeta->SetAttribDC(dcRef->m_hAttribDC);
//actually draw to the device context
CRect rcWnd;
GetClientRect(&rcWnd);
//draw meta file :: do what ever you want to do: bitmaps, lines, text...
DrawChart(dcMeta, rcWnd, false);
//done drawing
data->tymed = TYMED_ENHMF;
data->hEnhMetaFile = dcMeta->CloseEnhanced();
pData->CacheData( CF_ENHMETAFILE, data );
// Crashes
pData->SetClipboard();
// Release the meta file attributes
dcMeta->ReleaseAttribDC();
delete dcMeta;
delete data;
}
Regards.
|
|
|
|
|
I bet it's because you delete data. Once you call SetClipboard, data is no longer yours and windows handles it. When you call SetClipboard again, it's trying to delete the old pointer twice (because you already deleted it) which is bad.
|
|
|
|
|
HI
If i not Delete data , it also occured , i am very much confused why it is happening.
I am using Windows XP.
thanx
Regards.
|
|
|
|
|
What happens exactly? Are you ASSERTing or getting memory could not be read or what?
|
|
|
|
|
A crashing Error Occurs that windows XP usualy generates of Send or Dont Send
Regards.
|
|
|
|
|
zahid_ash wrote:
dcMeta->CreateEnhanced(dcRef, NULL, NULL,"Cca-Graph" );
Don't know if this has to do anything with your problem. But the documentation says : "The string pointed to by the lpszDescription parameter must contain a null character between the application name and the picture name and must terminate with two null characters —for example, "XYZ Graphics Editor\0Bald Eagle\0\0," where \0 represents the null character. If lpszDescription is NULL, there is no corresponding entry in the enhanced-metafile header."
suhredayan There is no spoon.
|
|
|
|
|
No your tip not works . sorry.
Program crashes before pData->SetClipboard(); when the its is copied 2nd time.
On first click it works ok , but on 2nd click it crashes
Regards.
|
|
|
|
|
I am sorry.
To get the result I displayed inthe previoous thread I wrote;
result.Format("%16I64d",(_int64*)GivenLongLong);
|
|
|
|
|
Using _int64 _atoi64(const char* string);
I wrote:
_int64 myLonLong=_atoi64("FFFFFFFFFFFFFFFF");//16 F
To display the result as a string:
CString result;
result.Format("%16I64d",myLongLong);
The result displayed is: 14 186 792 374 763 520
I am wondering if this is correct.
Thanks for any help.
|
|
|
|
|
This is incorrect. The range of an _int64 is –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. The problem however is that _atoi64 does not read in hex numbers, only decimal numbers.
|
|
|
|
|
Thanks very much.
What to do than to have a conversion of a LONGLONG from hexadecimal to decimal ?
|
|
|
|
|
sscanf from stdio.h will do the trick. Observe:
unsigned _int64 myLonLong;
sscanf("0xFFFFFFFFFFFFFFFF", "%I64i", &myLonLong);
note that I made _int64 unsigned to get the extra bit which 16 F's will use. The preceding 0x is to let sscanf know that the number coming in is hex.
|
|
|
|
|
Thank you so much for your help.
This is what I wrote:
//////////////////////////////////////
GetDlgItemText(IDC_MYHEX,hexNb);
// FFFFFFFF FFFFFFFF (16 F) is input.
unsigned _int64 myLongLong;
CString strResult;
sscanf("0x"+hexNb,"%I64i", &myLongLong);
strResult.Format("%I64i",(unsigned _int64*) myLongLong);
GetDlgItem(IDC_MYRESULT)->SetWindowText(strResult);
This is displayed result:
14 186 796 669 730 815
Do you think it is the correct answer ?
|
|
|
|
|
fardak wrote:
This is displayed result:
14 186 796 669 730 815
Do you think it is the correct answer ?
No, this is not correct for an input hex number of 0xFFFFFFFF FFFFFFFF (16 Fs). You can use windows calculator to check. If you set it to advanced mode it will let you enter hex numbers and convert them to dec. The problem you're having is you're casting myLongLong into a pointer which on a 32bit platform will be a 32bit value. The correct answer is 18 446 744 073 709 551 615. You want something like:
strResult.Format("%I64u", myLongLong);<br />
Notice that I changed the formatting from i to u, for unsigned. You don't need a cast because it will take anything as it's an ellipse argument and the format string is what interprets it.
|
|
|
|
|
Thanks.
But if I write,(without the type casting) :
strResult.Format("%I64u",myLongLong);//myLongLong);
GetDlgItem(IDC_MYRESULT)->SetWindowText(strResult);
The result is 0.
|
|
|
|
|
Check your code. The following has been tested.
unsigned _int64 myLongLong;<br />
CString strResult; <br />
sscanf("0xFFFFFFFFFFFFFFFF","%I64i", &myLongLong);<br />
strResult.Format("%I64u", myLongLong);<br />
|
|
|
|
|
You are right.
I fond the error:
sscanf("0x"+hexNb,"%I64u", &myLongLong);//error
Which should be formatted with i.
Thank you so much for your time and effort.
(My head stopped spinning !)
|
|
|
|
|