|
How would you get from a managed string to an unmannaged char array? I know there must be a more elegant way to get from point A to point B than:
sName - String
mcName - Char __gc[]
cName - char* (allocated for 256;Assert sName.Length <= 255)
mcName = sName->ToCharArray();
for(int j=0;j<mcname->Count;j++)
cName[j]=Convert::ToSByte(mcName[j]);
cName[mcName->Count]='\0';
|
|
|
|
|
I want to catch when the mouse is leaving a button.
When the mouse is or, I want to show a text in a static when the mouse is ovedr the button. And then the mouse is leaving the static will show another text. HOOOW!!!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Subclass frmom CButton and overriden <coe>WM_MOUSEMOVE.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Yes, and how to know if the mouse is leaving the button!??
Thats the problemo dude!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
I'm not sure but test this one:
WM_CAPTURECHANGED
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Chris has a cool CButton derived class demonstarting subclassing...perfect example of tracking mouse entrance and departure.
Custom Button
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Rickard Andersson wrote:
Yes, and how to know if the mouse is leaving the button!??
Use SetCapture() to keep receiving the messages even when the mouse moves off of the control... don't forget to call ReleaseCapture() once you are done with it.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
Hi,
I have Windows 2000 Professional SP2 installed and I have built an OpenGL base MFC MDI application which works fine under WINNT 4.0. The problem I have with Windows 2000 is that, when I create more than one window, I get a black border on the window edges, which increases with every new window. This problem does not appear with nVidia GEForce MX 200. I suppose this is so because, nVidia provides its own ICD, wherease others use the generic implementation. Is there any way out of this problem??
Thanks in advance,
|
|
|
|
|
Could anyone please, please help me.
I've got a doc/view app with a modeless dialog(subclassed), in the dialog I have a tree, when I select an item, I'd like to refresh the main view. Simple enough I would have thought, but I can't get it to work.
Should I be using messages or is there a simpler approach, is this enough information?
I'm still learning MFC, any help would be much appreciated, thanks.
UndeadHamster
Bye
|
|
|
|
|
To keep the doucument/View design pattern intact, always keep relevant data in your doc object, and then redraw your view through the existing mechanisms for this purpose. In your case it could be something like:
call the SelectTreeObject from your dialog:
public: CMyDocument::SelectTreeObject(CMyTreeData* pData)
{
m_pSelectedObject = pData;
UpdateAllViews(NULL, ID_SELECTION_CHANGED, pData);
}
CMyView::OnUpdate(CView *pView, UINT lHint, CObject *pHint)
{
if (lHint == ID_SELECTION_CHANGED)
{
// Do your stuff here, e.g. call Invalidate()
}
}
In your OnDraw() handler you could ask your doc object for the selected tree object. Don't forget to #define your ID_SELECTION_CHANGED to some value.
|
|
|
|
|
Thanks a lot, your time is much appreciated
UndeadHamster
Bye
|
|
|
|
|
can i user dbGrid with CRecordset?
Best Regards
|
|
|
|
|
Now I want to create a vs auto-completion style list to help user typing in the Edit control. First I just want to it popup at caret postion but just can't control it's exact position with GetTextMetrics. Next How can I send key press between edit and popup list?
Thanks.
Sing when we're programming.
|
|
|
|
|
GetCaretPos()
ClientToScreen() use these coordinates for positioning your popup window.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Christian or Kilowatt...you both seem to be quite aquainted with GDI and graphics so feel free to answer me...please...?
I'm interested in designing a small 3d type app which will not require texture mapping, The whole scene will be generated by the given poly coords and lighting opcodes etc...(I dunno if i'm 100% with terms, but excuse me if i ain't).
I'm also gaining interest in ATL and am considering approaching this with ATL (so it can be used in webpages AND applications).
Given the above how would you suggest I handle this...?
There are hundreds of online 3d lib's I have about 5 books that show me in detail how things work Gourand(speling) shading Phong(spelling) etc...
There there DirectX, OpenGL and how many other API's which are included on most OS's...I would figure anyway.
I've heard great things about DirectX...my fav game uses it and uses it well, but it's really to many bells and whistle. However this wouldn't matter I understand, cuz DirectX is already on most PC's and would probably provide best results because DirectX API (i imagine) uses MMX or 3DNow technology...depending on the PC architecture.
Knowing I won't need anything other than fancy shading, gradients, alpha factoring and anti-alising would it (maybe not make sense) but do any harm to open my books and copy paste...?
Or would you really suggest using DirectX API..?
I'd really like it to be fast, but doesn't require super speed...the scenes are small only about 64x64 pixels (my 286 could render that in the blink of an eye). And I would really like cross platform compatibility...
Is ATL supported in .NET...? Is it any easier...?
Thanx in advance.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
There is so much to learn about 3D graphics, I will try to help you as much as I can.
HockeyDude wrote:
I'd really like it to be fast, but doesn't require super speed...the scenes are small only about 64x64 pixels (my 286 could render that in the blink of an eye). And I would really like cross platform compatibility...
Do you mean UNIX, MAC and PC, or Windows95 - WindowsXP?
DirectX / Direct 3D is a good tool for the PC, but OpenGL is platform independant.
HockeyDude wrote:
I'm also gaining interest in ATL and am considering approaching this with ATL (so it can be used in webpages AND applications).
If you place it in a webpage, it will eihter need to be an ActiveX control, or a JAVA Applet. The activeX contol will lock you down to Win32, and the JAVA Applet will slow you down.
HockeyDude wrote:
Knowing I won't need anything other than fancy shading, gradients, alpha factoring and anti-alising would it (maybe not make sense) but do any harm to open my books and copy paste...?
This would not hurt, but then you do not gain the advantage of your 3D card doing the work for you. Recently I wrote a 3d viewer from scratch (for fun), that handles Flat, Gouraud and Phong shading. Gouraud and Phong really start to bog down my machine because of all of the CPU power that it uses. When possible, you should use a library that takes advantage of your card like OpenGL or DirectX.
HockeyDude wrote:
Is ATL supported in .NET...? Is it any easier...?
The only reason to use directX for this task is to place your renderer in an ActiveX control. For the most part you should be able to create your renderer without ATL. That way you can focus on one task at a time. Then when you want your viewer in a control, it should not be too much work to replace the painting portion of your control with the viewer.
HockeyDude wrote:
uses MMX or 3DNow technology...depending on the PC architecture.
Just for your information, these tools are not too much to get excited about, MMX is basically an extension to allow you to do native 3D operations with integers. Most 3D applications use floats for accuracy. The libraries use their own hardware on the video card to accomplish these tasks, and most tools ignore MMX.
I think I have answered most of your questions. If you have any others feel free to ask. k.
|
|
|
|
|
I want to write a program that can access to the network packets and …
How can I find information and source code about this?
Thanks
|
|
|
|
|
Does anyone have any simple examples for working with DDS images (as used by DirectX)
I've found an assortment of examples in the DirectX SDK, but these assume that the images are loaded as textures for display on a DX device, whereas I just want to get at the pixel data of the image(s) stored within the file.
Can anyone help?
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Hi
I experience big troubles when trying to implement IDataObject with support for CFSTR_* formats.
I first enumerate my available formats, like
ASSUME0(celt == 1 && !pceltFetched);
if (nFormatsEnumerated == 0)
{
rgelt->cfFormat = ::RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR);
rgelt->dwAspect = DVASPECT_CONTENT;
rgelt->lindex = -1;
rgelt->ptd = NULL;
rgelt->tymed = TYMED_HGLOBAL;
nFormatsEnumerated++;
return NOERROR;
}
else if (nFormatsEnumerated == 1)
{
rgelt->cfFormat = ::RegisterClipboardFormat(CFSTR_FILECONTENTS);
rgelt->dwAspect = DVASPECT_CONTENT;
rgelt->lindex = -1;
rgelt->ptd = NULL;
rgelt->tymed = TYMED_ISTREAM;
nFormatsEnumerated++;
return NOERROR;
}
else
{
return S_FALSE;
}
But when the data is requested, the lindex member of the FORMATETC structure is set to -1. I thought lindex would be set to the index of the file whose content is requested?
Anyone who has implmented this?
|
|
|
|
|
Hi
I have a HINSTANCE, I want to get HWND from it. Can you help me?
Thanks for your reading.
Tran Hoang Chuong
|
|
|
|
|
HINSTANCE is an instance handle to an application and an application can have many or no windows. I don't see how you would retrieve one HWND from any HINSTANCE.
If your using MFC then CWinThread::m_pMainWnd holds the pointer to the application main window and from here you could use EnumChildWindows() to get the others...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi HockeyDude
I forgot to tell more detail about my question. It means I have a HINSTANCE from a command ShellExecute(...) and I want to get CWnd of the application I have just exectuted.
Thanks for your reply.
Tran Hoang Chuong
|
|
|
|
|
I think the CWinThread is no good to you then.
I don't know of any function which would return the window handle associated with an HINSTANCE. Except EnumChildWindows which only returns child windows of a parent.
Can you use FindWindow()...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi HockeyDude
Thank you very much
Tran Hoang Chuong
|
|
|
|
|
if you figured it out that's all that matters
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|