|
Whats ur problm exactly ? is it to copy the DC to Bitmap or Bitmap to DC ?
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Jijoraj wrote:
Whats ur problm exactly ? is it to copy the DC to Bitmap or Bitmap to DC ?
Sorry if I wasn't making myself clear!
(1) I have a CBitmap and I'd like to find out what colour the pixel at x,y is.
(2) I'd like to set the pixel at x,y in a CBitmap to a specified colour.
I basically have the CBitmap OK, and can BitBlt it OK, but I'd like to access and change the CBitmap's pixels before I BitBlt the CBitmap.
Ta
I feel like I'm diagonally parked in a parallel universe
Jerry Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
Dear Jerry,
I think - first Get the whole bitmap data by calling GetBitmapBits () to an array, then process the array by using pointers and then setback the bitmap data by using SetBitmapBits (). I think it will increase perfomance. Then take care that allocate the array at heap using "new" operator.
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Thanks. However how do I decode the bitmap bits into pixel colours, and then encode them back into bitmap bits? The number of bits used for each pixel vary according to the colour depth of the bitmap.
I feel like I'm diagonally parked in a parallel universe
Jerry Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
For finding the colordepth of the bitmap, Use
BITMAP bmpInfo;
bitmap.GetBitmap (&bmpInfo);
then bmpInfo.bmBitsPixel will give you the color depth. Now the rest is easy, you got how many bits are used to represent each pixel of the bitmap and you had the bitmap data with you.
Simple, isn't it ?
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
|
Hi all!
can anybody help me change a application language (GUI) from one to another (immediately)
Ex: japanese -> English or vice versa
Thanks,
(
|
|
|
|
|
I'm sure there is a activex control that you can put on your application, that will allow you to just click somewhere on your application (EX. button), which will translate all text on that dialog to another language. Just search google.com for "free multilingual activex". Hope this helps.
|
|
|
|
|
First you need to compile your MFC application with unicode support (unicode MFC compilation in win9x does not work)
Then you put all your text elements of the dialog item in the resource and retrive the resouce string and update the ui in InitDialog(...)
So when you want to switch between languages, you simple change the text the resource table and that will be reflected on your application,
for this you need to recompile you code to make the switch.
In another case what you can do is to seperate out the resoure into seperate dll, Then load the resouce during runtime and also the strings from that dll,
so if you can have english.dll chinese.dll, depending on the dll you load your ui will be updated with the corresponding language.
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
Hi
I need some help in writing a windows console application that accepts non English input and output (Arabic) I tried to use console functions provided by the winapi but I didn’t succeed, what I tried was changing the code page but although it was changed I still couldn’t print non English characters.
|
|
|
|
|
Hi friends,
i am just now stepping into vc++. i want to develop some graphics applications using directx.
can any body help me in doing this.
if u can plz send me some code that demonstrated some basic functions for beginning in directx application.
ramachandran m s
|
|
|
|
|
|
1. Get the DirectX SDK: http://msdn.microsoft.com/directx/[^]
2. Run the DirectX Sample Browser. The sample browser contains many small examples and tutorials, written in C++, C#, and VB.
The SDK also includes a C++ DirectX Project Wizard for Visual Studio .NET that generates a small DirectX app based on the same example framework that the samples use.
- Mike
|
|
|
|
|
I have used two dialogs for my Tabbed Dialog control.
In my First Tab Page Contain one ListBox, I can't add/get the ListBox informations FROM 2Page.Kindly help me.
|
|
|
|
|
Depending on your application design, what you'd like to do eventualy is to get a list-box pointer to the second page.
Your options:
1. Use 'GetListBoxCtrl()' and 'SetListBoxCtrl()' (methods you'll have to write by yourself) from the piece of code that created Both pages and thus transfer a pointer, or the HWND of the ListBox to the second page.
2. Use a global variable to store the ListBox Pointer/HWND.
3. Use a singleton object to hold the same information.
|
|
|
|
|
Do u have the Source Code Example ? It will be more help full.
|
|
|
|
|
There's not much to show as an example, it's a "design pattern" (or lack thereof) if you twist it enough,
if at some point in your source-code you have code that looks like this :
.<br />
.<br />
.<br />
Pane1.Create()<br />
Pane2.Create()<br />
.<br />
.<br />
.
Simply add the lines
Pane2.SetListBox( Pane1.GetListBox() );
then write these functions:
CPane1::GetListBox() { return m_ListBox.GetSimpleHwnd(); };<br />
CPane2::SetListBox(HWND hWnd) { m_ListBox = hWnd; };
now you can control the listbox by sending messages from inside your Pane2 code to the m_ListBox window like:
SendMessage(LBm_ListBox, _ADDSTRING, ...);
|
|
|
|
|
for the following code, i am getting bret = false . why is that?
-------------------------------------------
if (OpenClipboard(NULL))
{
bret = EmptyClipboard();
char _Error_MSG_Macro_Buffer[MAX_STRING];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0,GetLastError(),0,&_Error_MSG_Macro_Buffer[0],MAX_STRING,0);
}
-------------------------------------------
if "OpenClipboard(NULL)" is true, then it should work with no problem, but it fails.
i don't have a window in my application.
"FormatMessage" gives the following:
"Thread does not have a clipboard open.
how can that be?
|
|
|
|
|
This piece of code works...
{<br />
HANDLE hClip;<br />
LPTSTR lptstr;<br />
<br />
if (!::IsClipboardFormatAvailable(CF_TEXT)) <br />
{
return; }<br />
if (!::OpenClipboard(NULL)) <br />
{
return;} <br />
<br />
hClip = ::GetClipboardData(CF_TEXT); <br />
if (hClip != NULL) <br />
{ <br />
lptstr =(LPTSTR) ::GlobalLock(hClip);
if (lptstr != NULL) <br />
{ <br />
<br />
MessageBox(lptstr);
<br />
::GlobalUnlock(hClip); <br />
} <br />
} <br />
::CloseClipboard(); <br />
}
|
|
|
|
|
I can get the string from the clipboard.
The problem is that i can't set a string to it.
that's the reason i need to use EmptyClipboard.
EmptyClipboard failed.
|
|
|
|
|
|
i tried using the code from your first link (i changed OpenClipboard() to OpenClipboard(NULL)), but it doesn't work for me.
i am getting "Thread does not have a clipboard open." with GetLastError for "EmptyClipboard" function call.
the function i am using resides in a DLL. could that be the reason for the problem?
|
|
|
|
|
Hi,
see what MSDN says...
If an application calls OpenClipboard with hwnd set to NULL, EmptyClipboard sets the clipboard owner to NULL; this causes SetClipboardData to fail.
OpenClipboard() and EmptyClipboard()will still work in a .dll
But we need to pass a proper HWND to set clip-board data.
Maybe you can create a window/ or use a window handle temporarily.
|
|
|
|
|
This same code snippet worked fine on my machine. Try calling GetOpenClipboardWindow() and/or GetClipboardOwner() after the clipboard is open. This does not solve the problem, but it might help to uncover something that is not immediately obvious.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I have done Wh_getmessage hook.
In my filter function i have typecast the Wm_char message
like Say if Char 'A' is pressed i send the char 'A' as it is to the application.
NOw if user press 'B' then what i am doing is changing the Char 'B' to BackSpace character.
TO this point the application is working properly in all application for it is a system wide hook , where pressing of B removes 'A' for B is a backspace character
A , B->backspace
out put = NUll
Now what i am doing is using PostMessage api i am sendging 2 characters to that application which is active
Say POSTMESSAGE(C ,D)
I got these problems:
1. The character C when posted to the application , my filter function is called again and( i have defined a rule for C where if the user type
C then change to E) and i expected C to be printed in the application , but instead E is coming.
I have to find a way how to prevent this ie the postmessage which i have send to the application looping through my filter funcion again and again.
___________________________________________________________________________
2. If i declare like this
A , B->backspace character , Postmessage(C,D)
Expected output
CD
Output obtained in notepad and photoshop
AC and D is removed(Wrong)
Output obtaied in all other application
CD(correct)
_________________________________________________________________________
3. So i tried this method
A , B->NULL , Postmessage(backSpace,C,D)
Expected output
CD
Output obtained in notepad and photoshop
CD(correct)
Output obtaied in all other application
AC and D is removed(Wrong)
Could anyone tell me how i can overcome these problems
Thanks in advance
with regards
vimal
|
|
|
|