|
Assuming you are using MFC, doesn't CMetaFileDC::Create[^] create a WMF (while CMetaFileDC::CreateEnhanced[^] creates an EMF)? Then you can use blitting -i guess- to place the bitmap in the metafile.
p.s: if you are not using MFC then there's CreateMetaFile[^] API call...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
yes CMetaFileDC::Create creates a meta file just i have in my resource a bitmap file im loading it to an CBitmap and then i dont know how to convert it and i dont know what blitting is or how it works im sorry im new in mfc we never had that at school
|
|
|
|
|
Ah, i thought your problem was that you wanted a WMF and not an EMF file.
Try something like this:
CMetaFileDC metaDC;
metaDC.Create(...);
CBitmap bitmap;
bitmap.LoadBitmap(...);
BITMAP bitmapInfo;
bitmap.GetBitmap(&bitmapInfo);
CDC memoryDC;
memoryDC.CreateCompatibleDC(&metaDC);
CBitmap *originalBitmap = memoryDC.SelectObject(&bitmap);
metaDC.BitBlt(0, 0, bitmapInfo.bmWidth, bitmapInfo.bmHeight, &memoryDC, 0, 0, SRCCOPY);
memoryDC.SelectObject(originalBitmap);
memoryDC.DeleteDC();
DeleteMetaFile(metaDC.Close());
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
after loading the bitmap i get at CreateCompatibleDC a zero value and then asserts
the bitmap file is loaded into CBitmap and the create gives also a valid value
what am i doing wrong
|
|
|
|
|
Ok now it works the complete source looks like this
<br />
CMetaFileDC metaDC;<br />
metaDC.Create();<br />
<br />
CBitmap bitmap;<br />
bitmap.LoadBitmap(IDB_BITMAP2);<br />
<br />
BITMAP bitmapInfo;<br />
bitmap.GetBitmap(&bitmapInfo);<br />
<br />
CDC memoryDC;<br />
(memoryDC.CreateCompatibleDC(NULL);<br />
<br />
CBitmap *originalBitmap = memoryDC.SelectObject(&bitmap);<br />
metaDC.BitBlt(0, 0, bitmapInfo.bmWidth, bitmapInfo.bmHeight, &memoryDC, 0, 0, SRCCOPY);<br />
<br />
HMETAFILE Handle = metaDC.Close();<br />
CopyMetaFile(Handle,"filename.wmf");<br />
memoryDC.SelectObject(originalBitmap);<br />
memoryDC.DeleteDC();<br />
<br />
<br />
DeleteMetaFile(Handle);<br />
<br />
<br />
thank you alot
|
|
|
|
|
Glad you figured it out, sorry i didn't answer earlier but by the time you submitted your reply i was probably already in bed. Nice work.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
WMF and EMF has an advantage that it will be scaled for the destination device context.
These files contain records of coordinates and the corresponding shapes.
Using these records, the image is scaled and redrawn.
When you put a bitmap into an EMF or WMF, this advantage is lost.
The image will either remain the same size if you do a BitBlt or will be stretched/shrunk if a StretchBlt is done.
What I'm saying is that there is no real advantage in converting a bitmap to an EMF.
|
|
|
|
|
yes i know but im using the wmf file just for converting it into a Rtf object which is made by the rtfGenerator class and it only accepts wmf
|
|
|
|
|
Hi,
I created a control(C1) at run time and one more control(C2) at run time on a dialog.
I want C2 on the Top of C1. I used SetWindiwPos but no use..
How can I do it?
|
|
|
|
|
AbhiHcl wrote: I used SetWindiwPos but no use..
What happened? How are you verifying the Z-order was not changed?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
What kind of controls are they(C1 & C2)? If you could be more specific what to do you want to achieve, its easier for people to help.
Regards,
--
"Programming is an art that fights back!"
|
|
|
|
|
We have a MFC project which is create in VS 4. It is converting to VS 6 then VS.net 2002 version 7.
It Use MFC in a Shared DLL It builds only in Debug mode. The EXE(using VS.net 2002) runs in another computer by distribute some .DLL files.
Now we convert this in VS 2008. After compiling it in Debug mode when we want to try run this EXE in another computer it gives error "This application has failed to start because the application configuration is incorrect.Reinstalling the application may fix this problem."
This application we can not build in release mode. since there is no option to Release mode only debug mode available. Please advice. We have tried by distributing the .dll files.
|
|
|
|
|
tdc_india wrote: This application we can not build in release mode. since there is no option to Release mode only debug mode available.
You have to build the application in release mode in order to distribute it. What do you mean by there's no option to Release mode ??
Furthermore, you have to install the redistributable package[^] on the target computer.
|
|
|
|
|
We cannot find any option to build in Release mode only Debug mode is available in Configuration manager dialog Box/Toolbar. Please advice.
This project is convert from Vs 4 to Vs 6.0 then Vs.net 2002, Now in Vs 2008.
in Vs.net 2002 the application is built in Debug mode and then distribute this with .dll files then work fine.
|
|
|
|
|
If you dont find a release mode then you can add it yourself in the configuration manager and copy settings from debug mode if required. We should never distribute an executable built in Debug mode to the production environment as application crash might result in unexpected popups. So , rebuild it in release mode in VS 2008 and if it still fails to run on the other machine you can install VS2008 redistributable on the machine and also try with the latest version of .Net framework.
Also , try setting your VS2008 settings to VC++ environment from the tools tab
PS: Please note ... debug version may be a short-term solution but it should always be avoided as it a box of worms in the long term.
-Kushagra
|
|
|
|
|
We have done every thing as you suggest. But I failed to run this project in another computer. This EXE only execute where VS studio installed.
Thanks
Nandi
|
|
|
|
|
tdc_india wrote: This application we can not build in release mode. since there is no option to Release mode only debug mode available. Please advice. We have tried by distributing the .dll files.
As Cedric already told you, you should build your application in release mode to deploy it; if you don't have a release configuration in the Configuration manager you can add a new confguration and set it in the proper way. Copy the required dependencies and settings from the existing debug configuration and change the required settings to obtain a release configuration (you can use the Project wizard to create a new application and see what it set there for the release configuration).
Another thing you should be aware of, is that Microsoft give you the right to redistribute the release version only of the runtime, then you shouldn't redistribute the debug version of its DLLs.
Cheers,
Sauro
|
|
|
|
|
We have done every thing as you suggest. But I failed to run this project in another computer. This EXE only execute where VS studio installed. Thanks
Nandi
|
|
|
|
|
You should install the service package 1 for the visual studio 2008
|
|
|
|
|
I am using VS 2008 professional edition. I installed service pack 1. But when I create brand new project using wizard then gives compilation error for the new project. I cannot compile in Debug/Release mode. That is why we cannot create new project after install Service pack 1.
|
|
|
|
|
hello guys...everything seems to be fine here but when I call at my landline number it does't show me the number.
TapiInitialize()
void WINAPI TapiInitialize() {
LPLINEDEVCAPS lineDevCaps = NULL;
lineDevCaps = (LPLINEDEVCAPS)LocalAlloc(LPTR, 4096);
EventReply = CreateEvent(NULL,FALSE,FALSE,NULL);
memset(&LineInitializeExParams,0,sizeof(LINEINITIALIZEEXPARAMS));
LineInitializeExParams.dwTotalSize = sizeof(LINEINITIALIZEEXPARAMS);
LineInitializeExParams.dwOptions = LINEINITIALIZEEXOPTION_USEEVENT;
result = lineInitializeEx(&lineApp,NULL,(LINECALLBACK)&lineCallbackFunc,NULL,&numDevs,&tapiVersion,&LineInitializeExParams);
if (result!=0)
printf("TAPI could't be Initialized");
else printf("\n\nTAPI Initialized..");
num = numDevs;
printf("\nNumber of lines available to this app: %d",(LPWSTR)num);
result = lineNegotiateAPIVersion(lineApp,0,API_EARLY_VERSION,API_CURRENT_VERSION,&tapiVersion,0);
result = lineGetDevCaps(lineApp,0,tapiVersion,0,lineDevCaps);
result = lineOpen(lineApp,0,&hLine,tapiVersion,0,0,LINECALLPRIVILEGE_MONITOR,LINEMEDIAMODE_DATAMODEM,NULL);
if(result!=0)
printf("\nLINE could't be Opened...");
else
printf("\nLINE Opened...");
TapiShutDown()
void WINAPI TapiShutdown() {
result = lineShutdown(lineApp);
if (result==0)
printf("Line closed successfuly");
else
printf("something went wrong");
}
and lineCallbackFunc().
VOID FAR PASCAL lineCallbackFunc(DWORD hDevice,DWORD dwMsg, DWORD Param1, DWORD Param2, DWORD Param3) {
if (dwMsg == LINE_REQUEST)
printf("incomg line...");
}
In the main(), I just call these functions.
int _tmain(int argc, _TCHAR* argv[])
{
TapiInitialize();
Sleep(180000);
printf("\n\nPress any key to close line....");
getche();
TapiShutdown();
return 0;
} Where am I doing something wrong??
modified on Tuesday, September 21, 2010 1:21 PM
|
|
|
|
|
|
You need to open a TAPI-device before you can receive any events - use lineOpen.
Most likely you will wan't to preceede that with lineNegotiateAPIVersion and lineGetDevCaps.
|
|
|
|
|
thanx...that really was the problem though it is still not solved but im working.
|
|
|
|
|
Do any of the printf() statements work?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|