|
Look past MSDN mag issues. You've got a free VBScript/JScript engine mouse/keystroke recorder.
|
|
|
|
|
I've created a pattern brush (not sure if this kind of brush is the right one) in this way:
HBITMAP hBmp=NULL;
m_Height = 400;
m_Width = 622;
CString csPath = "C:\\xxx.bmp";
hBmp=(HBITMAP)::LoadImage(NULL,csPath,IMAGE_BITMAP,m_Width,m_Height,LR_LOADFROMFILE);
CBitmap *pBmp=CBitmap::FromHandle(hBmp);
m_brush.CreatePatternBrush(pBmp);
::DeleteObject(hBmp); And I try to show it using this code (in OnPaint()):
CRect rcClient;
rcClient.left = 0;
rcClient.right = rcClient.left + m_Width;
rcClient.top = 0;
rcClient.bottom = m_Height;
dc.FillRect(&rcClient,&m_brush); I'm trying to use this code in order to show a big image as background, I need to place it not at 0,0 coordinates, and it seems impossible by using this code because it seems that the pattern always begin at 0,0... the problem is that if I change the drawing coordinates, the rect that is filled is filled correctly (the size of the rect is the right one) but the image being drawn inside is not the desired (it gets drawn not at the starting point of the image, it is started at the x,y offset in which the rectangle is being drawn; and when the image reach it's end, then it's restarted at its 0,0 coordinate...
How can I do it?
Thank you in advance...
|
|
|
|
|
see my article,
WndImage Control[^]
It provides the "basics" to paint a bitmap, plus supports tiling (which you're probably looking for).
[edit] I just noticed I didn't update the article yet. An updated version with palette handling support can be found here[^]
Italian is a beautiful language. amare means to love, and amara bitter.
sighist | Agile Programming | doxygen
|
|
|
|
|
Can anyone tell me the easiest way to handle events fired from ATL control in a MFC application. There is a code here at CP but it works only if the connection point interface inside the control is not a dispinterface.
|
|
|
|
|
are there any setting can confine the function?
help me!
|
|
|
|
|
1. open browse dialog without MFC
2. show picture at picture control
3. load ANI extension
I would like all example, somebody help me.
thank a lot.
|
|
|
|
|
1. GetOpenFileName()
2. See this[^] link
3. Not sure what you mean.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
1. successed
2. in tab controls have edit box, button, static text, radio button, picture, combobox etc. i would like to know the fuction to use display bitmap into picture control that create from tab controls
3. assume i have ANI file(test.ani) that animation of icon file, i would like to know the function to use Load and Display ANI file
|
|
|
|
|
Hello,
I've written a program in VisualC++ to call a DLL file. I came to the DLL file by compiling a Matlab file with the function mcc. When I write a simple DLL file (output=input) my C++ program works very well and gets a good link with the DLL. But when I change the DLL file a little bit(output = 3* input), my program gets no good link with the DLL file. It seems that the main function can't call the other subfunctions of my dll file(the functions that are extra created when I changed my DLL file to "output=3*input" and are needed to perform the multiplication)
Please, can you explain me what's wrong, what I have to change??
Is their something wrong with the settings of my program?
Could you give me a good example of such a program?
Is there maybe something wrong with the mcc compiler code?
The code I used was "mcc -W lib:libFLOPS -t -h -T link:lib libmmfile.mlib FLOPS".
This is a part of my C++ program:
void CDLLTESTDlg::OnStartdllbutton()
{
typedef mxArray*(* LPFNDLLFUNC1)(mxArray* input);
HINSTANCE hDLL; // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer
hDLL = LoadLibrary("libFLOPS.dll");
if (hDLL != NULL)
{
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"mlfFLOPS");
if (!lpfnDllFunc1)
{
// handle the error
FreeLibrary(hDLL);
SetDlgItemText(IDC_RESULTDLLCALL,"ddl found, but no function");
}
else
{
// call the function
char szTemp[100];
mxArray *INPUT=NULL,
*OUTPUT=NULL;
INPUT=mxCreateScalarDouble(100);
OUTPUT=(*lpfnDllFunc1)(INPUT);
sprintf(szTemp,"%f",mxGetScalar(OUTPUT));
SetDlgItemText(IDC_RESULT,szTemp);
SetDlgItemText(IDC_RESULTDLLCALL,"ddl en functie gevonden");
FreeLibrary(hDLL);
}
}
}
Thanx for your support ,
kind regards,
Geert
|
|
|
|
|
Hi,
the simplest reason could be a PATH problem. Probably Mathlab engine must be addressed to the OS: your DLL has the Mathlab Engine implicilty linked and so OS do load your DLL only if all the dependencies are loadad.
Try to add the Mathlab engine path in the PATH env variable: use Dependency Walker to find the dependencies of your DLL and than search the file in HD.
|
|
|
|
|
Could you explain me what you mean with "try to add the Mathlab engine path in the PATH env variable: use Dependency Walker to find the dependencies of your DLL and than search the file in HD"
Thanx, kind regards,
Geert
|
|
|
|
|
In order to use Mathlab functionality you need some DLL for sure. You probably have linked your app with the enty point lib of these. There is a free utility called Dependency Walker that can help in identify the DLL your component need. All these DLLs must be present in one or more of the following path list:
- your app path;
- the %systemroot% path;
- the %winnt%\system32 path;
- one of the path specified by the PATH environment variable;
If something gets wrong in loading any of these DLLs your primary DLL cannot be loaded and you experience the problem you have reported.
More info in "Advanced Programming for Windows" by Richter
|
|
|
|
|
What do you just mean with?
- the %systemroot% path;
- one of the path specified by the PATH environment variable;
I'm not such an experienced programmaer
Kind regards,
ciao,
Geert
|
|
|
|
|
%systemroot% : the directory of windows (if you are using XP it's probably c:\windows, if you are using NT/2000 it's probably c:\winnt).
Check in the Windows online help "Environment Variables", type SET PATH on command prompt and get the content of the PATH env var.
You'll see ";"-separated list of paths, append the path of the Mathlab DLL folder you found w/ the method I have explained earlier.
Probably you 'll need a help by someone more expert in the dept you are working...
|
|
|
|
|
|
|
Some problems with your question
1. There is a language called c as opposed to c++. Is that what you mean ?
2. The question is way too broad, and you're on a site full of information on the topic, if you meant C++. Either way, how can anyone explain such a huge topic in a reply to a message board ?
If you meant C and not C++ then you obviously cannot use MFC, and your best bet is to buy 'Programming Windows' by Charles Petzold. You need to make sure you get his book for C and not his book for C#, which is the newer one.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Perhaps they've heard of the legendary powers of the posters on CP and assumed that the gurus could tell the full nuances of the question from that one emoticon?
Debbie
|
|
|
|
|
Hi
I need to check whether a button of a toolbar has an "disabled" image or an "enabled" image. The toolbar is owned by an external app, I have the HWND wndTToolBar of the toolbar. That's what I have so far:
CToolBarCtrl bar;
VERIFY(bar.Attach(wndTToolBar));
Everything works fine, I can hide certain buttons, get the number of buttons and so on. But how can I find out, what image a button has, say button with the index 5?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If found out, I just queried the iBitmap value of the button. Works perfectly now.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
Suppose I have a class a vector (defined in vector.h) as a member of the class.
Throughout the methods of the class I insert elements (strings that are read from a file, not allocated with "new") into this vector. Should I erase all the elements of the vector in the destructor of the class? If so - why? aren't these string allocated on the stack?
Same question for a vector I declared in one of the class methods. Should I call clear() on this vector at the end of the method?
Thank You.
-----------------------
Go USA Go
|
|
|
|
|
you don't need to manually empty the vector, unless the objects in the vector require manual deletion (like, if you have a vector of pointers). otherwise, the contents of the vector will be automatically destroyed; the d'tors of all contained objects will be called by the vector d'tor.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
I'm sorry that this is a realy basic question -
About the vector which is a member variable of the class - when is its Dtor called? My guess is when the object "dies" but i'm still not sure.
Is it normal to have a constructor (which doesn't allocate any memory on the heap) and no destructor in a class?
Thanks for your patience .
-----------------------
Go USA Go
|
|
|
|
|
About the vector which is a member variable of the class - when is its Dtor called? My guess is when the object "dies" but i'm still not sure.
vector dtor is called as part of your class dtor (the compiler automatically handles this). So, yes, the vector is destroyed when the owner object dies.
Is it normal to have a constructor (which doesn't allocate any memory on the heap) and no destructor in a class?
It is pefectly normal, specially if all members take care of their own cleanup. Remember that your class never lacks a dtor: if you don't provide one the compiler generates it automatically, and will call appropriate dtors for member objects and base classes.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Makover wrote:
when is its Dtor called?
when the containing object dies. if CFoo has a vector, the vector's d'tor is called as part of the CFoo d'tor.
Makover wrote:
Is it normal to have a constructor (which doesn't allocate any memory on the heap) and no destructor in a class?
constructors and destructors are totally optional. there's nothing wrong or unusual to not have one or the other (or both) in a class. if your class isn't responsible for any heap-allocated memory then you probably don't need a d'tor.
one exception to this is when you have a class where the d'tor performs some kind of useful side-effect: like CWaitCursor which show the hourglass cursor in the constructor then shows the normal cursor in the destructor.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|