|
I developed a MDI Doc/View Application in MFC with Splitter windows(3 pans). Each view of pan contains item list in TreeView form. When any one of these pan had focus i couldn't get ToolTip from ToolBar. If i close the pan which contains the focus then I could get ToolTip. What could be the possible reason?
Direction regarding this is highly appreciated.
Thanks and regards,
Rajan
"I'mpossible = Impossible"
|
|
|
|
|
I've been tossing this one around for days and can't figure it out. I'm trying to dynamically load DLLs using the LoadLibrary/GetProcAddress method. I know I've loaded the library, but I can't get GetProcAddress to find the function. Here's the code.
<br />
private:<br />
typedef Object __gc * (__cdecl *Builder)();<br />
Builder build;<br />
HINSTANCE library;<br />
FARPROC holder;<br />
Object * wompi;<br />
<br />
DLLoader::DLLoader()<br />
{<br />
library = LoadLibrary(_T("LeetTrans"));<br />
if(library != NULL)<br />
{<br />
<br />
holder = GetProcAddress(library,_T("Build"));<br />
if (holder != NULL)<br />
{<br />
build = (Object __gc*(*)()) holder;<br />
wompi = build();<br />
}<br />
}<br />
}<br />
<br />
Object __gc * __cdecl Build()<br />
{<br />
LeetTrans * a = new LeetTrans();<br />
return a;<br />
}<br />
<br />
Object __gc * __cdecl Build();<br />
And finally, here's the stuff from the .DEF file in the DLL. I don't even know if I need this:
LIBRARY "LeetTrans"
EXPORTS
Build @1
I don't know what else to do. Anyone can even lead me in the right direction? Thank you in advance for any help.
|
|
|
|
|
holder = GetProcAddress(library,_T("Build"));
mention the function ordinal in place of _T("Build")
|
|
|
|
|
This could really work, but I don't know how to mention the ordinal in LPCSTR format so that GetProcAddress will understand it.
I'm SOOOOOOO close! Once I get this, I'm pretty sure the rest of the program will fall into place! Thanks to everyone for your help. Wow i've had too much caffeine.
|
|
|
|
|
Ok for starters drop the _T macro from the GetProcAddress call, function names in libraries aren't stored in Unicode - you'll just get compiler errors when you trying moving to a Unicode build.
Next try searching under the Visual Studio folder for a file called 'depends.exe' and open the DLL using it, it will show show you a list of all the functions exported by the library. Check the function is being exported with the name you think it should be, the chances are it's not and it's got a load of giberish trailing after it. If it does you will need to declare any functions you wish to export using the extern "C" keyword, if your not sure what it does check MSDN for more details[^] but it basically tells the compiler to export the function without mangling the export name - sorry thats a really bad explanation of what it's doing but i'm just entering my 28th hour of a serious coding session and running low on coffee
Gavin Taylor
w: http://www.gavintaylor.co.uk
|
|
|
|
|
I enjoy the Sobe drinks myself.
I couldn't find the 'depends.exe', but I changed the DLL code to look like this:
<br />
extern "C" Object __gc * __cdecl Build();<br />
<br />
extern "C" Object __gc * __cdecl Build()<br />
{<br />
LeetTrans * a = new LeetTrans();<br />
return a;<br />
}<br />
The FARPROC variable back in the main exe is still coming up NULL. I'm using the debugger to watch it come back. It just isn't finding the Build function. Thanks for your help, especially considering your work. Good luck with your code.
|
|
|
|
|
OK now I feel thick
Now i've just started to wake up again and noticed your trying to import / export managed code, AFAIK it isn't possible using the standard Windows API - don't hold me to that though as I'm definately no .NET expert. I *think* the only way to do it would be to create a proper .NET assembly and import them as references... again *i think* as it's the only way i've ever mixed c++ with .NET - i could be wrong though
Gavin Taylor
w: http://www.gavintaylor.co.uk
|
|
|
|
|
I have to write a dialog-based program (using MFC) which saves the position of the dialog to Window registry when user log off Window.
I've tried to save dialog's position in DestroyWindow() function but it doesn't work.
Could u tell me a way to solve this problem?
Thank in advance.
Trunghd
|
|
|
|
|
Hi,
Handle WM_CLOSE message
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I've tried to handle WM_CLOSE message but it doesn't work, may be WM_QUERRYSESSIONEND message is better.
Many thanks for ur advice.
|
|
|
|
|
Does anyone know of any DVD/CD burning libraries that are opensource or shareware? I know of a few which cost a bit and I may eventually break down and buy them... but I'd prefer to ease the learning curve by starting with something cheap that I can play around with.
em: raddog_AT_kc.rr.com or jfe_AT_americancentury.com
Thanks!
- john ferguson, kansas city
|
|
|
|
|
Why don't you try nero API, it is free. But you and those who will use your program would need a nero installed.
|
|
|
|
|
I have a CRichEditCtrl object that contains multiple lines of data. Each line is from 1100 to 2030 characters long. For some reason the rich text control is word wrapping the line at character 1025. Can anyone suggest a way to avoid word wrapping? I do not want any wrapping at all.
Thanks in advance for your help.
|
|
|
|
|
You might check this link out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/vcrefcricheditctrlsetwordwrapmode.asp
I've not used this control, but you could potentially override the default wordwrap handler via the EM_SETWORDBREAKPROC message. I don't know if this would work, but perhaps by taking over the wordwrap responsibilities you could effectively disable it.
You might check here, too: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/richeditcontrolreference/richeditmessages/em_setwordbreakprocex.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrols.asp
best of luck.
- john
|
|
|
|
|
const type_info &t0=typeid(CWnd);
const type_info &t1=typeid(CEdit);
t0==t1;
|
|
|
|
|
Have you enabled run-time type info (/GR compiler option)? Have you #include typeinfo.h?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I forgot to include typeinfo.h.
Thanks.
|
|
|
|
|
Hi All,
I want to do Intelligent bitmap depth conversion.
Convert XXX to XXX (without color lose):
24 bits --> 16 bits (If few color used that can fit in 16 bits)
24 bits --> 8 bits (If few color used that can fit in 8 bits)
24 bits --> 4 bits (If few color used that can fit in 4 bits)
24 bits --> 1 bits (If few color used that can fit in 1 bit)
Do u know, How I can find this bitmap has exact color(with no color lose) to fit in lower depth?
For example : If I have a 24bits baitmap, but that is using only two colors. These two colors can be shown by 4 bits bitmap without any lose of color, then I should use 4 bits bitmap WHY 24 bits.
Thanks
Sumit K.
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
There are a few articles on working with bitmaps at CP. I do not remember if CxImage supports bitmap color depth conversion, but it supports multiple image formats. The CDibData class does support such conversion, but I never did get around to updating it (a bug-dealing with compression).
The only reason for converting your two color bitmap, from a 24-bit format, is to reduce the storage requirements. Think about that; a 24-bit image stores each pixel value in 3-bytes, a 4-bit image stores two pixels values per byte. A 4-bit bitmap image does require that a palette be provide, but that palette will, in this case, have only two entries.
INTP
Every thing is relative...
|
|
|
|
|
16-bit colour simply allocates fewer bits per colour than 24-bit. A common 16-bit format which is easy to describe uses 5 pixels each for Red, Green, Blue, with one unused, i.e. it is 15-bit. True 16-bit allocates 6 bits for green, I think.
To check whether an image is entirely suitable for 15-bit, you could use brute-force, and step through every pixel, checking that the 3 least-significant bits for each colour are all zero. Theoretically, you loose information if you discard non-zero bits.
Alternatively, you could just force 24-bit images to 16-bit, but this can give visible changes in the image.
To convert to 8-bit per pixel or lower, I don't think there is an easy way.
I would allocate a 256-member array for 24-bit colour values, then step through the pixels, one by one. For each pixel, check if the value is in the array. If the colour value is in the array, go on to the next pixel. If it is not, add its colour value to the array. If the pixel's colour value is not in the array, but the array already has 256 colour values, then sorry - your image can not be converted to an 8-bit image without loss of quality!
((I seem to remember something about 16 "system reserved" colours in an 8-bit image, so you may only be able to use 240 colours.))
|
|
|
|
|
for 24 to 16 no idea come to mind...
For 24 to 8 bit.. ya..you are right I have to iterate and find out about color usage, that's already going in my mind,
For 256 colors we can make 216 colors by combinations of(0,51,102,153,204,
255)and other 40 colors I have not found yet..how to find these..
But I don't think, it's a good idea. I m working in this direction..but mind is still trying to avoide this method.
Regards,
Sumit K
sumit_kapoor1980@hotmail.com
|
|
|
|
|
Hello all,
I have a CDialog derived class that is set as Child, no border, no title bar, no menu. I am using this dialog as a child in another dialog. BUT, I would like to use this child dialog as a MODAL dialog. If I use this code :
{
CDlgEcu locDlgEcu;
if( locDlgEcu.DoModal() == IDOK ){
// ADD DATA TO LIST
}
}
then I can see only some controls from this dialog and dont see dialog backgroud, title bar, border ...
if I try to use ModifyStyle so this function set some of flags but not all that I need ....
this code dont work:
ModifyStyle( (~0x00), WS_POPUP|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CAPTION|(WS_SYSMENU|WS_THICKFRAME)
);
ModifyStyleEx( (~0x00), WS_EX_CONTROLPARENT|WS_EX_WINDOWEDGE);
Does anybody have ANY advice, please?
thnx.
xSoptik
|
|
|
|
|
I would like to capture the text or the HTML code from a page displayed in Internet Explorer.
I try to achieve this by enumerating all windows that match "Internet Explorer_Server" class using EnumWindows() and EnumChildWindows()to get the handle to the window and IHTMLElement to get the HTML code. But this doesn't work with a page that uses frames. It only reads the text from one frame.
Does anyone have an ideea of how I can achieve this?
<br />
if (strTemp==string("Internet Explorer_Server"))<br />
{<br />
CoInitialize(NULL);<br />
HINSTANCE hInst = ::LoadLibrary( _T("OLEACC.DLL") );<br />
string strTemp;<br />
CComPtr<IHTMLDocument2> spDoc; <br />
LRESULT lRes;<br />
<br />
strTemp="";<br />
UINT nMsg = ::RegisterWindowMessage( _T("WM_HTML_GETOBJECT") );<br />
::SendMessageTimeout( hwnd, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD*)&lRes );<br />
<br />
LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT)::GetProcAddress( hInst, _T("ObjectFromLresult") );<br />
if ( pfObjectFromLresult != NULL )<br />
{<br />
HRESULT hr;<br />
hr = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument2, 0, (void**)&spDoc );<br />
if ( SUCCEEDED(hr) )<br />
{<br />
CComPtr<IHTMLElement> pHTMLElement; <br />
hr=spDoc->get_body(&pHTMLElement);<br />
BSTR bstrText;<br />
pHTMLElement->get_innerHTML(&bstrText);<br />
strTemp=(char *)_bstr_t(bstrText);<br />
<br />
MessageBox(hwnd, strTemp.c_str(), "text", 0);<br />
<br />
}<br />
}<br />
::FreeLibrary( hInst );<br />
}<br />
<br />
This is how I get the text when I have the handle to the "Internet Explorer_Server" window.
|
|
|
|
|
Read the IHTMLDocument2::frames property to get a list of all frames under the top-level HTML document. You'll have to recurse through that collection since frames can have sub-frames.
For each frame object, QI it for IHTMLWindow2 and then read the document property. You can then use your existing code to read the contents of that document.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Shots do not hurt other players... yet
|
|
|
|
|
my view base on CEditView, I want to hide a cursor. How to do that ?
|
|
|
|