|
In visual C project (MFC type) go to insert menu and select bitmap option. Browse for your picture file and add it.Under resources tab in the project navigator check the ID of the bitmap file. Then under OnPaint() function add this piece of code.
CPaintDC dc(this);
CBitmap bmp , *poldBmp;
CDC memdc;
bmp.LoadBitmap(IDB_BITMAP1); // IDB_BITMAP1 is the ID of the bitmap loaded
mdmdc.CreateCOmpatibleDC(&dc);
poldBmp= memdc.SelectObject(&bmp);
dc.BitBlt(10,10,47,47,&memdc,0,0,SRCCOPY);
memdc.SelectObject(poldBmp);
//Do not call CDialog::Onpaint() for painting
|
|
|
|
|
I think he wants to insert a image to a control(maybe static control or no).
|
|
|
|
|
savitri wrote: in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program
I think you are looking for Win forms help. Then I think this is not the message board, you have dedicated message board for WF.
Anyway, right click the picture box you have "Choose Image" option in the context menu. Or go to the property View and Image Option has the field to set the Image.
And if you looking for Picture Control in win32/MFC, in the property view, set the type of picture control to Bitmap, and specify the ID of the bitmap resource in the Image field
modified on Tuesday, March 4, 2008 7:47 AM
|
|
|
|
|
You can use of this code for insert image to your control.
#include AtlImage.h
CImage m;
m.Load(_T("c:\\1.jpg"));
m_Control.SetBitmap(m_.detach());
|
|
|
|
|
Hi Experts,
How can I pass a message from dll application to other application?
|
|
|
|
|
With PostMessage , of course.
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
|
|
|
|
|
What's a "dll application"?
We deal in "processes" here
Do you need to pass a message from one process to another?
If so... Interprocess Communications[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
pther wrote:
How can I pass a message from dll application to other application?
have you dll has any window, or it just one way communication!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Hi all,
I am writing this code in VC 2005
TCHAR szPath[MAX_PATH];
CStdioFile sys_file_ptr;
GetModuleFileName(NULL,szPath, MAX_PATH);
PathRemoveFileSpec(szPath);
suppose file is located at this path
szPath = C:\New Folder\new.exe
and after using PathRemoveFileSpec() API i am getting this result
szPath = C:\New Folder
i want to add a slash at the end of the string. i do it using this code
szPath = szPath + _T('\\');
it gives error
error C2440: '=' : cannot convert from 'TCHAR *' to 'TCHAR [260]'
i have tried strcat()also but it also gives some error.
somebody can tell me how to do this......
|
|
|
|
|
neha.agarwal27 wrote: error C2440: '=' : cannot convert from 'TCHAR *' to 'TCHAR [260]'
i have tried strcat()also but it also gives some error.
use _tcscat() inplace of strcat, as you are using generic text data type.
|
|
|
|
|
You cannot do string concatenation that way with a character array. you must go on with a C-like approach:
_tcscat(szPath, _T("\\"));
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
|
|
|
|
|
neha.agarwal27 wrote:
i want to add a slash at the end of the string. i do it using this code
szPath = szPath + _T('\\');
Aside from that being syntactically wrong, why not just use PathAddBackslash() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi everybody!
In a project I am working on I have a modal dialog and I would like to show an other modeless dialog by clicking on a button.
The modeless dialog is created before the DoModal is called, and therefore after clicking on the button (only ShowWindow(SW_SHOW) ) the modeless dialog it will appear, but I can't click on it, because it has no focus.
Have anybody an idea how can be solved this problem?
Thanks in forward.
|
|
|
|
|
potyex wrote: The modeless dialog is created before the DoModal is called, and therefore after clicking on the button (only ShowWindow(SW_SHOW) ) the modeless dialog it will appear, but I can't click on it, because it has no focus.
that is the behavior of Modal Dialog, the user cannot interact with other windows until the dialog box is closed, then you have to go for Modeless dialog instead.
|
|
|
|
|
Why not create and show the modeless dialog after the button is clicked?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Because is too late to create after button click. I have to communicate with that dialog, it is alive (but not visible) durring the project run.
|
|
|
|
|
How can I have my application always in top
|
|
|
|
|
what about,
SetWindowPos(hWndApplication, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
modified on Tuesday, March 4, 2008 6:59 AM
|
|
|
|
|
Or create window with WS_EX_TOPMOST extended style.
You can change position after window is created only using Rajkumar'a approach.
JohnCz
MS C++ MVP
|
|
|
|
|
HI,
Iam a VC++ programmer having 3 years experiance.
Few of my friends telling that no new Project or Product starting using VC++, only maintenace products need VC++.
I want to know is there good future to vc++ ? or shall i need to migrate to .Net Technologies.
I hope there must be experianced People in this group please advice me.
|
|
|
|
|
Krishnatv wrote: Few of my friends telling that no new Project or Product starting using VC++, only maintenace products need VC++.
IMHO the above is wrong. Anyway .NET (and Java ) probably will grow their market share. You may have a look at recruiter agency websites (like Jobserve) to get a rough idea of C++ (against .NET languages) opportunities.
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
|
|
|
|
|
Krishnatv wrote: Few of my friends telling that no new Project or Product starting using VC++, only maintenace products need VC++.
That sends a clear message about your friends.
Krishnatv wrote: I want to know is there good future to vc++ ?
Yes.
Krishnatv wrote: shall i need to migrate to .Net Technologies.
That entirely depends on your personal interests.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks for your replies.
Iam intrested in VC++ and COM.
We are doing a product Using MFC and COM.
My Company dealing many projects in C# and Asp .
Presently one of our onsite Coordinator Also telling that there is lots of opportunities in .Net than VC++.
Our Product didnt get any strong Client to get good Revenue.
But All these .NET Projects are from good Clients.
All these issues, make me to think.
Bye,
Krishna.
|
|
|
|
|
Hi Krishna,
It is not a wrong thing if someone tells you that there are more opportunities with .NET than with MFC. But I won't agree if someone says MFC or Visual C++ has no future. I would suggest you to give .NET a try too. If that interests you, you could then easily decide which way to go. .NET have more opportunities, but to my mind, Visual C++ is more interesting. I think it is too personal and must be left to the individual to decide. Good luck.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Krishnatv wrote: Using MFC and COM.
I will pray for your soul....
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|