|
i am so greatful to u, thanks thanks....if u have any other idea or article known plz let me know..
Every man is unique
|
|
|
|
|
I enumerate all open windows with Enumwindows. In the processor function I try to check if the title of the window contains a certain string. If yes, put the handle in a list of handles(m_wndList).
if(hwnd)
{
CWindow win(hwnd);
CHAR str[100];
win.GetWindowText((LPTSTR)(str),100);
if (strncmp(str,"searchstring", 13) == 0)
dlg->m_wndList.push_back(hwnd);
}
It compiles, but I get the following error messages:
Run-time Check Failure #2: Stack around the variable str is corrupted
and/or
Run-time Check Failure #2: Stack around the variable win is corrupted
What is the problem? How should I change my code?
|
|
|
|
|
There's some problems with your code. What's with the (LPTSTR) nonsense? My guess is that you're building a Unicode application and casting away the compiler warnings (the (LPTSTR) cast I mentioned before) which were informing you of the real problem: that CHAR str[100]; is not a Unicode string. Try this:
if(hwnd)
{
CWindow win(hwnd);
TCHAR str[100];
win.GetWindowText(str, 100);
if (_tcsncmp(str, _T("searchstring"), 13) == 0)
dlg->m_wndList.push_back(hwnd);
}
Don't cast unless you're sure what the cast actually means, and don't try to cast away error messages.
Steve
|
|
|
|
|
To complement the answer from Stephen, I suggest you read this excellent article[^]. You'll be able to really understand why your code is wrong.
|
|
|
|
|
Thanks guys, you both helped me a lot. At the moment I just cut & paste any code I find, but this will change I hope.
|
|
|
|
|
keret wrote: if (strncmp(str,"searchstring", 13) == 0)
Why 13?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I had an other searchstring originally.
|
|
|
|
|
Before Vista, it seems that the design of mac os is better than of Windows.
I want to know if Vista or Windows 7 is trying hard to redesign,
and how far it can go considering compatability.
How about totally redesign, and make xp as a subsystem for compatability.
|
|
|
|
|
followait wrote: Before Vista, it seems that the design of mac os is better than of Windows.
So, in your opinion Unix architecture is better than Windows one?
followait wrote: How about totally redesign, and make xp as a subsystem for compatability.
The (latest) big turn (IMHO), in Windows evolution was the adoption of the NT architecture.
XP 's one is fair good, Vista & Windows 7 , AFAIK aren't such a redesign.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: So, in your opinion Unix architecture is better than Windows one?
After I comparing them via some architecture illustrates.
Mac's is more clear than Windows' from this perspective.
|
|
|
|
|
Hello,
I wrote a program that export as pdf format (as string,bitmap)
and now i want to export as Excel office (ex. as version 2003)
What's the best class for generate 'Excel' document with vc++ 6.0?
|
|
|
|
|
You may go through automation, see, for instance [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I wanted to transfer some files from the remote machine(which is located in same LAN) to local machine. For that i am going to use WGET command.
Can any one help me how to use this command for transferring files, because it is expecting http and ftp formats only.
I have tried with shared path, it's not working... Can any one help me regarding this..?
Thanks
Venkatesh.
|
|
|
|
|
Venkatesh,
This is the C++ forum. You will probably get a better response from the System Admin[^] forum.
I have WGET on my Unix based server and doing 'wget -h' produced a verbose list of options.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi there,
I would like to register an ActiveX programmatically, but I encounter several problems.
First of all, I register my ActiveX in the program and it works correctly like this:
ShellExecute(m_hWnd,"open", "regsvr32", "D:\\WINNT\\system32\\Macromed\\Flash\\Flash9f.ocx", "", SW_HIDE );
But I'm interested in hiding the dialog after registering.
Also, how can I find out that is this ActiveX registered already?
On the other hand, I would like to check ActiveX registeration on the local system and if it doesn't register, register it.
I think CoCreateInstance can help me to recognize, but I'm not sure.
Please help me my friends.
Thanks in advance.
|
|
|
|
|
regsvr32 has a /s option that will not show the message box at all.
You can also register a component by loading it using LoadLibrary and calling its exported DllRegisterServer function.
To find if the ActiveX is already registered, check if the following registry key exists.
HKEY_CLASSES_ROOT\CLSID\<CLSID of ActiveX>\InProcServer32
The value of Default of the above key will contain the path to the ActiveX.
«_Superman_»
|
|
|
|
|
You may also register it (programmatically) loading the corrensponding DLL and the calling DllRegisterServer .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I tried this[^] Google search got the following result (1st in list):
http://msdn.microsoft.com/en-us/library/ms177531(VS.80).aspx[^]
What follows is a quote from the page:
The REGSVR sample is the source code to the existing REGSVR32.EXE utility. This utility is used to invoke the self-registration code built into ActiveX controls that adds or removes a control's information in the registry. Developers can use this sample to modify the behavior of the REGSVR32 utility.
Don't be afraid to use Google!
Steve
|
|
|
|
|
I have created dynamic buttons and loaded a plain bitmap on them. Now I want to place a text on those bitmapped buttons, how can we do that?
|
|
|
|
|
As far as i know the "default" buttons given to you by windows don't support both images and text on a button, so i'd say you have 3 possibilities:
1. Use a third party custom button which supports both text and image
2. Handle drawing of the button yourself, you have to be able to draw all its possible states, like pressed, disabled, ... and adding theme support is usually also a good idea
3. This is imho the easiest and simplest solution, draw the text onto the bitmap you place on the buttons. So load the bitmap, draw text on it and feed it to the button. If you need to change the text, load it again, draw the new text, feed it to the button.
I hope this helps, good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thnx a-lot I will go with drawing text.
|
|
|
|
|
Hi,
I have a few questions regarding the EditWordBreakProc callback function
Specically how to handle the return value for the Different codes
fo WB_ISDELIMITER if the current charcter is a delimter return 1
otherwise 0
but the other ???? WB_RIGHT ?? WB_LEFT ?? RIGHTBREAK LEFTBREAK
are they just for postioning the caret
What if all I am interested in the line break and highlighting the new
the first few postions of the new line ???
As in a dialog box displaying storage locations can I ignore the other
codes
|
|
|
|
|
Hi all,
I'm trying to write a c++ program that opens and plays a .avi file. I've managed to open it and play it, but I cant get the video to display - I know it's playing as I can hear the sound.
What do I need to do get the video to display? If I need to create my own window can you please post some code to help me with this, as I've been trying to do this but havent managed with success yet. If not, is there a way i can get it to open in windows media player or something?
Below is my code - thanks in advance
czk
#include <iostream>
#include <windows.h>
#include <mmsystem.h>
#include <conio.h>
#pragma comment(lib, "winmm.lib") // Link winmm.lib into the program
using namespace std;
int main()
{
MCIERROR err;
cout <<"Open video"<<endl;
err = mciSendString(L"Open C:\\video.avi type AVIVideo Alias Video", NULL,0,NULL);
if(err !=0 )
{
cout <<"Error";
}
cout <<"Play"<<endl;
err = mciSendString(L"Play C:\\video.avi wait",NULL,0,NULL);
if(err !=0 )
{
cout <<"Error";
}
cout <<"Close"<<endl;
mciSendString(L"Close C:\\video.avi",NULL,0,0);
return 0;
}</conio.h></mmsystem.h></windows.h></iostream>
|
|
|
|
|
try the following....
call mciSendString( _T( "put Video window at 0 0 400 400" ),NULL,0,NULL)
before mciSendString(L"Play C:\\video.avi wait",NULL,0,NULL);
aks
|
|
|
|
|
Sorry about late reply, been on holiday...
I put that line of code after the play command and it worked a dream:
mciSendString(L"Open C:\\video.avi type AVIVideo Alias Video", NULL,NULL,NULL);
mciSendString(L"put Video window at 0 0 352 264",NULL,0,NULL);
I did get an error about vids:mp42 decompressor being missing. This codec is included with windows meadi player but apparently the later versions are direct show only (i'm using media player 11). However, I installed an older codec from here, http://www.moviecodec.com/downloads/28d.html[^], and it played the video correctly. Just thought i'd share that in case anyone else has the same problem.
Cheers for the help aks
czk
|
|
|
|