|
void C3StateTree::OnRButtonDown(UINT nFlags, CPoint point)
{
UINT uFlags = 0;
HTREEITEM hItem = HitTest(point, &uFlags);
if( uFlags & TVHT_ONITEM )
{
CString sText = GetItemText(hItem);
Arjan
|
|
|
|
|
|
hi evrybody
i"m trienig to change my cursor during the time the app runs - first of i load the cursor in the main func
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
where wc is my window and than i want to open a dialogbox where i would change my cursor in
anyone can help on how to do it ???
thanx alot
|
|
|
|
|
You handle the WM_SETCURSOR message in the dialogbox procedure.
|
|
|
|
|
I think you have to handle the wm_setcursor message in the dialog or window and after call it:
<br />
case WM_SETCURSOR:<br />
{<br />
HCURSOR hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_MYCURSOR));<br />
SetCursor(hCursor);<br />
return TRUE;<br />
}<br />
I hope this helps...
Well... I am a beginner ...
|
|
|
|
|
|
Hi i am doing following:
From my function SaveAsBitmap
CClientDC dc(this);<br />
MemDC.Detach ();<br />
MemDC.CreateCompatibleDC(&dc);<br />
<br />
m_WfrBmp.Detach ();<br />
m_WfrBmp.CreateCompatibleBitmap(&dc, 860, 1100);<br />
CBitmap *pOldBitmap = (CBitmap *)MemDC.SelectObject(&m_WfrBmp);<br />
<br />
MemDC.SetMapMode(MM_LOENGLISH);<br />
MemDC.SetBkMode (TRANSPARENT);<br />
MemDC.SetBkColor (RGB(255,255,255));<br />
<br />
MemDC.Rectangle (100,100,400,400);<br />
<br />
Filename ="C:\\12.bmp";<br />
CDIBSectionLite dib;<br />
HBITMAP hnd = (HBITMAP)m_WfrBmp.GetSafeHandle (); <br />
dib.SetBitmap (hnd);<br />
dib.Save(Filename);
I am getting Black bitmaps only.....
What is the problem...
Any help/suggestions
Leave your mark wherever you go
|
|
|
|
|
get your header info and write your bitmap pixel per pixel (binary so use fwrite)
NOTE: write away like BGR and NOT RGB. For some reason it is that way. (think memory access time is the reason, but I'm not sure)
Find some info on the net about the structure of a bmp file.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Maybe you should Get the bits of the MemDc
Try this @ home. (B&B)
|
|
|
|
|
I hope there is nothing attched before you make those calls to Detach() or your program will have resource leaks.
After drawing to the bitmap via Rectangle, select pOldBitmap into MemDC. If either function SetBitmap() or Save() needs to select it into a DC, then neither one can do it until MemDC releases ownership. A bitmap can only be selected into one DC at a time.
INTP
|
|
|
|
|
I currently use a CTreeCtrl with checkboxes for each item. How can I know when I check an item.
Is there an event sent to the control or something else ? The method CTreeCtrl::Getcheck() works, but I must to have informations just when I click, to update several datas ...
--
Gizmo
|
|
|
|
|
Gizmo79 wrote:
How can I know when I check an item.
Have you looked at either the TVN_SELCHANGED or TVN_SELCHANGING notification?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
void C3StateTree::OnLButtonDown(UINT nFlags, CPoint point)
{
UINT uFlags = 0;
HTREEITEM hItem = HitTest(point, &uFlags);
if( uFlags & TVHT_ONITEMSTATEICON )
{
if(GetCheck(hItem))
{
TraverseDownAndSelectTree(hItem, false);
TraverseUpAndSelectTree(hItem, false);
}
else
{
TraverseDownAndSelectTree(hItem, true);
TraverseUpAndSelectTree(hItem, true);
}
}
}
Arjan
|
|
|
|
|
Thanks, it works fine.
I don't use the WM_LBUTTONDOWN event, but the NM_CLICK event and it works too.
I didn't know how to verify if the mouse was over the checkbox, but know, it's done. Tanks you.
--
Gizmo
|
|
|
|
|
Hello,
my MFC dialog based app uses a freeware activex I found on the net.
To use it, the relative ocx file must be registered in the system.
Is there a way to make the app do itself without the user having
to run regsvr32 c:\..... ?
I added the lines
STARTUPINFO si;<br />
PROCESS_INFORMATION pi;<br />
ZeroMemory( &si, sizeof(si) );<br />
ZeroMemory( &pi, sizeof(pi) );<br />
CreateProcess(NULL,
"regsvr32 MyOcx.ocx",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi );
inside InitInstance().
It seems to partially work:
with the ocx unregistered, the first time I execute the app
it brings out the information message box saying "DllRegisterServer MyOcx..."
From now on each time I execute the app first I see the box and finall the app.
I'd love to skip the first dummy execution and to close automatically the system info box without having to hit OK.
Any suggestion about this?
Thanks for the precious help.
Marco.
|
|
|
|
|
use "regsvr32 myocx.ocx /s"
NOTE: /s parameter this makes it register silently!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
Hello,
I have a dialog, for example dialog3, which can be created by dialog1 and dialog2 through .DoModal(). How to decide which dialog is the parent dialog In the class dialog3?
thanks inadvance
|
|
|
|
|
dadacncn wrote:
How to decide which dialog is the parent dialog In the class dialog3
Are you talking about GetParent() , or IsKindOf() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
yes. I think I need GetParent() or IsChild(). But I don't know how to use them. do you have an example? maybe it will help me.
|
|
|
|
|
Haven't tested it, but this might work:
CWnd* pParent = NULL
pParent = GetParent();
if(pParent)
{
if(pParent->IsKindOf(RUNTIME_CLASS(CDialog1)))
elseif(pParent->IsKindOf(RUNTIME_CLASS(CDialog2)))
else
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thank you very much. but in the .h and .cpp files of CDialog1 need DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC.
|
|
|
|
|
I want to Serialize several HTMLs(2 or >2)with source into a single file.for example *.abc. when I load the file that saved,I can show the HTMLs in a htmlview.How to do this? I have never worked on file Serialize.I need your help.I use VC6.Thank you very much!
Alick
|
|
|
|
|
How about you create a CStringArray.
Copy each stream of HTML text into a separate CString.
Assign these CStrings to the CStringArray.
Serialize the CStringArray to your file.
When you reload it, each HTML 'file' will be in its own CString.
You can use each CString as the HTML text for your view.
|
|
|
|
|
Thank you for your idea. but how about the source(jpg,gif etc.) and how to encapsulate? I intended to use ziplib. what I want to do is just the direct explore modal of winzip(double click on a zip file,winzip will open it,doesn't extract exactly you can see the files encapsulated in the zip file).
In my condition there is just one addition that I encapsulated just HTMLs with source.I hope I can open a html file in my HtmlView not lanuch IE. That's all.
Thak you all the same,Blake.
|
|
|
|
|
How do you set the position of a dialog box, as you cant call SetWindowPos before DoModal, nor can you call it after, as the dialog box window doesnt exist.
Thanks
|
|
|
|