|
|
Hi,
I am trying to call some methods from a dll provided by IBM as part of it's emulator API (PCSAPI).IBM's documentation recommends implicit linking. I lost the original lib file so I made one with with the implib utility that comes with Borland C++ Builder. This works fine in C++ Builder but VC++ says the lib file is corrupted.
[rant]Almost everything works in BCB and alomost nothing works in VC++. I cant use BCB because my company refuses to buy BCB[/rant]
I got a GPF when I tried explicit linking using the procedure name. How can I create a lib file for use with VC++ ?
Sahir
|
|
|
|
|
You could use the LoadLibrary function and get a pointer to the functions you need to call... its not as good as having the .lib but it solves the problem.
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
|
|
|
|
|
I tried that. I was able to get the procedure address too. But when I tried to call the function I got an access violation. I even tried writing an intermediary DLL in Borland C++ Builder. When I call the intermediary DLL I still get an access violation. This must be why IBM recommends implicit linking. Is there some utility which will create a lib file from a DLL?
|
|
|
|
|
I want to use some compare string functions,so I find strcmp,wcscmp,_mbscmp .It seems that they are case sensetive.How can I manage them that they become case insensitive?For example there is no differenece between "Ma" and "ma" and all M and m be the same?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
_stricmp()
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks.Thats exactly what I want.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I have a formview class and I want to catch press key events.I overriden KeyUp and KeyDown in it but it seems that they do not fired when I press keyboard keys.How can I catch press key in my form view class?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Those are the correct events. What keys are you trying to catch ? Maybe you need to catch them in your MainFrame ( I would not have thought so, but I can't really remember much MFC )
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Christian Graus wrote:
Maybe you need to catch them in your MainFrame
No,I want them in my View Class.
Christian Graus wrote:
What keys are you trying to catch ?
I want delete key,but I test them for all of my keys and they didn't fired.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
No,I want them in my View Class.
I'm sure you do. I want a million dollars. I am saying that I *think* you may have no choice but to catch them in your mainframe class. I could be wrong, but if I am right, I am saying you're stuck with it. You should probably wait until someone who is still lumbered with MFC can give you a better reply, because as I said, I have not been for some time.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Overriding ::PreTranslateMessage may help,
And I swallow a small raisin.
|
|
|
|
|
thanks.It works.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Does anyone know how to host the web browser control in an sdi app in the client rectangle using only straight com interfaces? I dont want to use htmlview
|
|
|
|
|
Then pick inside the CHtmlView code, which is MFC code provided in vcdir\mfc,
And I swallow a small raisin.
|
|
|
|
|
put the webbrowser control to the window.
classwizard generates a wrapper class for the ActiveX object.
it's usually called WebBrowser2
use its Create method to put it on the window
|
|
|
|
|
Hi all,
I have a dialog based application in which i'm loading a picture in to a static control during run time using the load image function.The problem is that after displaying the image, if i minimise and then maximise my dialog or if i switch over focus to another window and come back to my dialog the picture from my dialog dis appears. The code used for displaying bitmap is given below.Can anyone tell me what's wrong with this?
##########################################
//In Dialog Header
RECT rectStaticClient;
CDC m_dcMem; // Compatible Memory DC for dialog
HBITMAP m_hBmpOld; // Handle of old bitmap to save
HBITMAP m_hBmpNew; // Handle of new bitmap from file
BITMAP m_bmInfo; // Bitmap Information structure
CPoint m_pt; // Position for upper left corner of bitmap
CSize m_size;
##########################################
CMyDialog::OnInitDialog()
{
CClientDC dc(this);
m_dcMem.CreateCompatibleDC( &dc );
return true;
}
##########################################
CMyDialog::OnDisplay()
{
m_st3.GetClientRect( &rectStaticClient );
m_size.cx = rectStaticClient.right; // zero based
m_size.cy = rectStaticClient.bottom; // zero based
m_st3.ClientToScreen( &rectStaticClient );
ScreenToClient( &rectStaticClient );
m_pt.x = rectStaticClient.left;
m_pt.y = rectStaticClient.top;
CClientDC dc(this);
GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );
VERIFY(m_hBmpOld = (HBITMAP)SelectObject(m_dcMem, m_hBmpNew ) );
dc.StretchBlt( m_pt.x, m_pt.y, m_size.cx, m_size.cy,
&m_dcMem, 0, 0, m_bmInfo.bmWidth-1, m_bmInfo.bmHeight-1,
SRCCOPY );}
With regards
|
|
|
|
|
|
No i'm calling this function in the button click event.I wrote the same code in the onPaint() and called Invalidate() in my Button click event.But the image just views and get disappeared very immediately.So i changed it.
|
|
|
|
|
[NOT PART OF ORIGINAL MESSAGE - What happens to scrollbars when you use OnNcPaint() why do they disappear and how do I bring them back, thanx]
I have tried in the past to use these 2 painting handlers only to stop flicker in one or the other...NOT both.
I thinking it is becuz NcPaint gets called renders its display and blits it to the screen, then OnPaint does the exact same thing...(I think it's in that order).
So my question is this...
Is it possible to use one bitmap for both OnNcPaint and OnPaint...and blit the bitmap to the screen HDC at the end of OnPaint or OnNcPaint() or which ever gets called last...???
This would avoid the double double buffering and hopefully avoid flicker in both not just one...
is this possible...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I would say that it is possible, but I think that you may cause other problems because of the way that Win32 handles a windows update region. A WM_NCPAINT and WM_PAINT message are only generated when an invalid portion of the window is detected. When you get a WM_PAINT message, and you call BeginPaint, the only portion of the window that you will be allowed to paint in is the invalid region.
What I would suggest that you do is create one bitmap to represent the entire window (border and client area) and use that bitmap to update the window when you get an update message and that should accomplish what you are trying to solve.
The one other optimization that you could make (but you will have to test this) is when you get a WM_NCPAINT message, and the update region is a 1. That means that the entire window needs to be refreshed. You could possibly blt the entire bitmap to teh window, then call ValidateRect(hWnd, NULL) in order to validate the entire window. This would cancel any WM_PAINT message that you may have received because you already updated the window (once again you will have to test this to make sure that there are not any side effects.)
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I'm at a loss as to how to have flicker free drawing code in both the client and non-client...I thought maybe my mentioned approach would work. I have already got the entire control drawing flicker free but only in the client. I would like to split the control drawing though and do some in the non-client area. It would make windows messages easier to handle.
p.s-What happens to scroll bars when non-client painting is used...? Do I have to redraw them myself...???
cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I have designed a control in which is split into 2 classes.
The base class being a memory management class (MMC) with members like setText() getText(). The control is derived from CWnd and MMC. What would be the best way in terms of OOD to have the base class MMC notify the parent to refresh the display when a setText() is called...
Obviously I can't have Invalidate() inside MMC::setText because it isn't derived from CWnd it's a CObject...
Can I do this with down casting...? Currently I have an OnRefresh() handler virtual void function declared inside MMC which MMC:setText() and similar functions call...in the control (CWnd derived class) I override this member function and call invalidate from here.
Is there a better way...? Is this acceptable OOD...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Does your control derive from MMC or does it contain a MMC member variable?
If you need your control to update after each MMC function is called then I would suggest making a MMC member variable and write some wrapper functions for your control
MyControl : public CWnd
{
void setText()
{
m_MMC.setText();
Invalidate();
}
MMC m_MMC;
}
instead of
MyControl : public CWnd, MMC
{
}
Todd Smith
|
|
|
|
|
Thats how I originally implemented the control but figured the virtual method offered a cleaner more OOD friendly interface.
class MMC{
public:
setText()
{
}
protected:
virtual void OnRefresh()
{ }
};
class ctrlList : public CWnd, MMC{
public:
void OnHScroll()
{
ScrollDC();
Invalidate();
}
protected:
void OnRefresh(){ invalidate(); }
};
The above is my reasoning and current implementation...I would personally prefer deriving from MMC instead of using composition just becuz I already have way so many member variables another like m_mmcBuffer; would just add to the confusion so I figured deriving would allow for a cleaner looking code syntax.
Why would composition be your preferred way of doing things? Is the virtual OnRefresh() that big of a performance hit...?
Thanx!
cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|