|
Thank you. I will try changing that. Debugging I guess should have been it.
I am sorry. I am just getting into C++ from VB and It's been a nightmare.
Thanks A million.
|
|
|
|
|
Hang on. Don't give up. You will get there.
The guys here at CP will definitely help you on your way.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks. However I have spent the whole day searching on this for loop with bitmaps,arrays and somesort of convertion of bitmap to text and haven't been sucessful.
I have a bitmap in memory. I have been able to tell the location of the text I need and with some good firsttimers luck am sucessful in telling different characters out. This is one of the reasons I am learning C++. However since I am new with this.
My question is
The bitmap is 100 by 20 that I have been able to capture so far.
I have also been able to identify that the character is only using up 6X15 of the space. followed by a consistent gap between characters to form a word or numbers.
My question now is what would be the easiest way to be able to relate that information to a textfile as opposed to a bitmap.
I know it's dumb doing it but if I can get someone's help on this I think I will not be bothering anyone for a while.
Please advice.
|
|
|
|
|
Dear all
I have a project which can be both compiled with VC6 and VC 2005
When I compile it by VC6, the content of LPCSTR is one byte per character
but when I compile the project under VC2005 , I find that each character of LPCSTR is consist of 2 bytes which first byte contains the character data and second byte contains a "0" in it.
thus I cant show the data properly as I want
what happened under VC2005
could you please help me how I can overcome this problem.
Is is about unicode and MCBS
How can I disable it under VC2005
Could you please send me an article for this problem.
I want to become more familiar with UNICODE
thanks in advance
Mahdi
|
|
|
|
|
I never used 2005, but in 2003 you can right-click your project in solution explorer, select Properties, under General you can set the the character set between unicode, MBCS and unset which basicly means simple, everyday, 1 byte per char strings.
> 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. <
modified on Saturday, March 7, 2009 4:21 PM
|
|
|
|
|
Yes, it is about UNICODE and MBCS as you correctly suspected.
VC6 by default does not use UNICODE , but VC 2005 used UNICODE as the default.
You can disable this through
Project -> Properties -> Configuration Properties -> General -> Character Set .
Here you can choose between UNICODE and MBCS .
On the other side, you can show the data or do any manipulation on UNICODE characters. You just need to use the wide version of the functions or the _t macros.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Chinese character is coming from "GetValue().bstrVal".. Take a look of following code..
bstrString_Dest = m_cpRecordsetSearch->Fields->GetItem("DestinationValue")->GetValue().bstrVal;
bstrString_Dest is declared as _bstr_t..
bstr_t bstrString_Dest
I tried with const whar_t *
const whar_t * bstrString_Dest
but no success..
My question is what data type should i use to hold chinese character in bstrString_Dest????
Thanks all..
|
|
|
|
|
I'd highly recommend you read these two articles:
These should answer your question and will be invaluable for the future, however make sure to read part I first as part II relies on knowledge obtained there.
|
|
|
|
|
A _bstr_t should certainly hold Chinese characters (it's effectively a managed wchar_t) - what's the problem that you're seeing?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
_bstr_t did hold chinese character.. But when i see the data using watch or print to any file it shows "????" only... Chinese fonts are definately installed in my system..As i'm reading from database and i can vivdly see chinese character in database.
Do i further need to typecast it??
Thanks..
|
|
|
|
|
How are you writing it to a file?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Now using this..
(char *)(wchar_t*)bstrString_Dest
|
|
|
|
|
As I asked before, "How are you writing it to a file?"
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm writing in ini file..Also i'm displaying in messagebox..Say the data is "Abc(Some chinese character)"
MessageBoxW(0, (wchar_t*)bstrString_Dest, 0, 0);
The messagebox prints "Abc(square brackets)".
WritePrivateProfileString(pszSection,pszKey,(char *)(wchar_t*)bstrString_Dest,
pszinipath);
And this prints "A" only...
|
|
|
|
|
gothic_coder wrote: The messagebox prints "Abc(square brackets)".
It's probably using non-Unicode font? The following code prints the expected ideaographs with Visual Studio 2008 and Windows 7
MessageBoxW(L"丁丂七", L"Test", MB_OK);
gothic_coder wrote: WritePrivateProfileString(pszSection,pszKey,(char *)(wchar_t*)bstrString_Dest,
pszinipath);
That's the ANSI call, so it's no surprise that you can't write Unicode successfully with that call. However, I don't think WritePrivateProfileString will write Unicode anyway.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Alright..
when i copy
MessageBoxW(L"丁丂七", L"Test", MB_OK);
It comes as
MessageBoxW(L"???", L"Test", MB_OK);
So it has something to do with my VC 6 setting..Isn't it..
Can someone throw light on it..
And please Stuart tell me how do i write the data on file (Notepad)???
Thanks
|
|
|
|
|
Well
MessageBoxW(0, (wchar_t *)bstrString_Dest, 0, 0);
giving me right data... Now the problem is how do i print this data to file?? Notepad??
Thanks..
|
|
|
|
|
Hello all,
I have a application where the file properties dialog is inadequate for the task so I want to use mine. There is an API for the application but there is no event for that particular dialog box so I am looking into windows hooks.
What I want to do is to capture this specific dialog box opeing so that I can shut it down and display my own.
I ideally want to do this in c# but from reading some articles, I understand that there is a certain amount i'll have to do in c++...Does anyone have any sample code that will achieve this or know of some good articles that will help? All I can seem to find are articles on keyboard and mouse hooks, I cannot find any articles that help with capturing dialog boxes let along specific dialog boxes of specific applications.
Any help will be appreciated.
Thanks
|
|
|
|
|
If you really want to hook, I believe you would need the WH_SHELL hook.
This should give you a notification when any window/dialog is going to be activated.
You have to find some method of identifying if it is right dialog.
If the file properties dialog is a standard windows properties dialog, I would recommend extending it rather than replacing it. You could use shell extensions for this.
Read these wonderful articles of shell extensions by Michael Dunn[^]
The Complete Idiot's Guide to Writing Shell Extensions - Index[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I am trying to capture text from an external application that has it's textedit control set to readonly and keeps scrolling based on certain market conditions. Using Getwindowtext returns me a null string and so do other functions. I am trying to stay away from hooking as much as possible.
Since I am getting NULL string back. I could be wrong, but hooking won't work either, am I right?
The question I have is:
I can set my mouse at the location I want e.g
Point.x = 288;
Point.y = 15;
I can keep the Lbutton Clicked.
///
This is where I need help
How do I now move the mouse cursor to
Point.x = 350;
Point.y = 30;
and highlight the text uderneath it.
///
Or the next option is to capture the area as a bitmap. The captured area will always be text. Is it possible to convert this bitmap easily into text without comparing to findout what pixel is on and off.
If it is possible doing it the second way. Can you please direct me to some reading material. I have tried doing a search..All results I get are in Visual Basic. I am trying to get away from Visual Basic if I can and start using c++.
In the mean time help with the first option will be appreciated too.
|
|
|
|
|
If you call GetWindowText from an external application you would not be able to get the text. You can inject code into the external application using hooks and then try to use GetWindowText on the control.
For the mouse movement, there is an API called SetCursorPos to move the mouse cursor. Or you could try sending the WM_MOUSEMOVE message with the button states and the new position.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Regarding the hooks. Due to somesecurity issues with the application and and the vendor..I will stay away from it for now unless I am really stuck I will use hooking.
Ok..I am able to set the mouse to the starting point of the text.
What you suggesting I have tried. Without releasing the button I moved it to the new position I wanted but the text is not hilighting. Not sure because of the moving the button gets released.
Here is the actual Code I used...
GetCursorPos CurMouse
SetCursorPos LongX, LongY
mouse_event MOUSEEVENTF_LEFTDOWN 0&, 0&, 0&, 0&
SetCursorPos CurMouse.X, CurMouse.Y
at this point I wanted the text highlighted but it is not.
|
|
|
|
|
In that case, I guess you would need to try and send the WM_MOUSEMOVE message.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Yeah..However If I can get some help on my bitmap issue. this will not be required.
trying hard to get this going it was one of the main reasons I moved to C++. Was strugling with it in VB for the last3 to 4 months and I think I might have this solved with a little more help.
Thanks a million. I do appreciate all the help from everyone here.
|
|
|
|
|
Hello all... I've Win32 application in which i extract data from database and put into some file..Say notepad.. I'm facing problem in extracting chinese fonts..
For ex if the entry in database is "Abc (Some chinese stuff)" after extraction it comes "Abc ???????" in buffer...
How do i properly extract chinese character in VC++ ??
Thanks all...
|
|
|
|