|
In the MFC dialog editor, set the Selection Type to "Extended"
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
I´m sorry, I don´t use the newsgroups
thanks!!!I have used the LVS_EX_DOBLEBUFFER and it works!! but..I get much flickering. Is there a way to relax this flickering?
thanks again
|
|
|
|
|
Hello,
Could anyone recommend an elegant way to insert a CBitmap (HBITMAP) object into a raw CRichEditCtrl (WITHOUT the doc/view architecure)? IOW, I need to create an OLE object from the bitmap handle (actually I am using GDI+ to generate this bitmap).
Regards,
BB
|
|
|
|
|
|
OK, but this HOWTO uses OleCreateFromFile to insert a bitmap FILE into the control, whereas I need to insert a dynamically created HBITMAP without saving it.
Regards,
BB
|
|
|
|
|
how about switch to OleCreateFromData?
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
Hi
I started learning MFC ... and I have some really stupid questions.
I hope someone can help me.
How can I pass on arguments to the program? In C or C++ I had the main function for this purpose but here ....Can I use InitInstance??
Basically what I want is my program to run like this:
MyApp.exe NrOfParam param param.... (list of parameters)
It's a simple dialog based application.
Second: can I have global variables accesible from every file of my project?
I'd be very grateful for any kind of help.
Muad-Dib
mailto:adamo_piar@freemail.hu
Made in Hungary
|
|
|
|
|
|
I am try to calculate 2D convolution and extract the central matrix of the convolution result. Here is my c++ code:
//create the kernel matrix
mxArray *mxKernel = mxCreateNumericMatrix(3, 3, mxDOUBLE_CLASS, mxREAL);
double *Kernel = mxGetPr(mxKernel);
//set the kernel
Kernel[0] = 2; Kernel[3] = 3; Kernel[6] = 1;
Kernel[1] = 0; Kernel[4] = 2; Kernel[7] = 3;
Kernel[2] = 4; Kernel[5] = 2; Kernel[8] = 1;
int Mk = mxGetM(mxKernel);//row of kernel
int Nk = mxGetN(mxKernel);//column of kernel
int M = mxGetM(ImportMatrix);//row of input matrix
int N = mxGetN(ImportMatrix);//column of input matrix
Input = mxGetPr(ImportMatrix);
//create the result matrix with elements 0
ExportMatrix = mxCreateDoubleMatrix(M, N, mxREAL);
Output = mxGetPr(ExportMatrix);
//do the algotithm
int i, j, k1, k2;
for ( i = Mk/2 + 1; i <= M + Mk/2; i++ )//output row
{
for ( j = Nk/2 + 1; j <= N + Nk/2; j++ )//output column
{
for ( k1 = 1; k1 <= Mk; k1++ )
{
for ( k2 = 1; k2 <= Nk; k2++ )
{
if ( ( i + Mk/2 + 1 - k1 >= 1
&& j + Nk/2 + 1 - k2 >= 1)
&& ( i + Mk/2 + 1 - k1 <= M
&& j + Nk/2 + 1 - k2 <= N) )
{
Output[( i - Mk/2 - 1 ) + ( j - Nk/2 - 1 ) * M] +=
Kernel[( k1 - 1 ) + ( k2 - 1 ) * Mk] *
Input[( i - k1 ) + ( j - k2 ) * M];
}
}
}
}
}
my code is quite slow and it is even slower than performing convolution with no extraction of central part. (this means that it is slower even the for loop is less in iterations)
Could anyone point out that how could I optimize this code?
Thanks very much.
|
|
|
|
|
tttyip wrote:
for ( i = Mk/2 + 1; i <= M + Mk/2; i++ )//output row
Calculate the middle value first - it is being calculated every time here.
tttyip wrote:
Output[( i - Mk/2 - 1 ) + ( j - Nk/2 - 1 ) * M] +=
Kernel[( k1 - 1 ) + ( k2 - 1 ) * Mk] *
Input[( i - k1 ) + ( j - k2 ) * M];
There's also stuff here you could calculate before the k1/k2 loops, anything you can calculate once and put in a variable, do it.
I've not taken time to see if the overall approach could change, but those two things should make some difference.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
anything you can calculate once and put in a variable, do it.
...but run a benchmark after each sub-optimization. quite often you'll hit a point where the compiler's optimizer will start to fight you: ie. it can do a better job if you don't make a certain optimization.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
Make sure you building in release mode with optimize for speed.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I'm looking for the linker equivalent to the #pragma warning (disable:xxxx) directive that will enable me to suppress, or disable, specific linker warning messages.
Cheers,
Tom Archer - Archer Consulting Group
Programmer Trainer and Mentor and Project Management Consultant
|
|
|
|
|
Hey,
I have a simple problem. I want the toolbar buttons to respond to double-clicking. Can i do this directly or do i have to create a toolbar(or rebar) manually with all the buttons and add a double-click event to a particular button? Can someone give me some pointers?
thanks and greetings Joris
|
|
|
|
|
This is completely non-standard and I'm sure will baffle your users. Why do you want to do this?
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Hey,
It isn't really a necessary item. But i want the toolbar buttons to do more then just invoke a command or open a dialog. I see that one can add controls to the rebar, guess i should read up on that. Btw, i'm just started using MFC, so i don't know all that is possible and not.
|
|
|
|
|
Does anyone know how to supress autorun programically?
I am using a C++ MFC Dialog based app in Visual Studio .Net 2003. I have tried the following code from MSDN but it doesn't work.
<code>
UINT g_uQueryCancelAutoPlay = 0;
BOOL DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
...
default:
if (!g_uQueryCancelAutoPlay)
{
g_uQueryCancelAutoPlay = RegisterWindowMessage(TEXT("QueryCancelAutoPlay"));
}
if (uMsg == g_uQueryCancelAutoPlay)
{
SetWindowLong(hDlg, DWL_MSGRESULT, TRUE);
return 1;
}
}
}
</code>
It seems that the registered message QueryCancelAutoPlay is never being recieved by
<code>
if (uMsg == g_uQueryCancelAutoPlay)
{
SetWindowLong(hDlg, DWL_MSGRESULT, TRUE);
return 1;
}
</code>
Any solutions ?
|
|
|
|
|
Is your application in the foreground? Otherwise, you must implement the COM interface.
From the MSDN 'Autoplay in Windows XP: Automatically Detect and React to New Devices on a System':
If the application wants to cancel Autoplay only when it's in the foreground, the application can listen to the QueryCancelAutoplay message. To cancel Autoplay, whether or not it's in the foreground, an application must implement the IQueryCancelAutoplay COM interface. The application then registers a component implementing this interface in the Running Object Table (ROT). The component will be called whenever an event generates an Autoplay action.
The QueryCancelAutoplay message only comes to the application in tthe foreground.
|
|
|
|
|
Okay, thanks I got it working.
How do you implement the COM interface version you mention?
Thanks
|
|
|
|
|
I have only done the message processing manner like you have, and I remember that my application had to be in the foreground (it was anyway, as part of a setup program).
The MSDN article I referenced had some links, perhaps to source code. Maybe it has an example of the COM interacce. I did not look.
|
|
|
|
|
Thanks,
It did have source code but for some reason the com part doesn't work.
It just gives the message not listening on a cd insert.
The article says:
To cancel Autoplay, whether or not it's in the foreground, an application must implement the IQueryCancelAutoplay COM interface. The application then registers a component implementing this interface in the Running Object Table (ROT). The component will be called whenever an event generates an Autoplay action.
So, in their example I clicked the appropriate box and it just says its not listening.
Thanks for your input.
|
|
|
|
|
I figured it out. You have to add a registry entry to get the com method to work.
|
|
|
|
|
is it possible to dynamically add image and text (using functions such as InsertMenuItem() ) to menu on Win98?
(not owner-draw)
if yes, How?
thx
|
|
|
|
|
I doubt it - that's what owner draw is for.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|