|
In Windows, it is GetCurrentDirectory .
|
|
|
|
|
AFAIK, the C++ language itself doesn't provide such functionality. And neither does any of the C runtime libraries (someone correct me if I am wrong). You have to use the underlying OS's (or any runtime environment's) APIs to achieve that. For Windows, Superman's reply holds.
...byte till it megahertz...
|
|
|
|
|
What about getcwd() / _getcwd()? Declared in direct.h or unistd.h for Unix
But for question the OP:
GetModuleFileName() returns the fully qualified path of the application.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
kakan wrote: What about getcwd() / _getcwd()? Declared in direct.h or unistd.h for Unix
Oh YEAH! Thanks! direct.h is in Windows too.
...byte till it megahertz...
|
|
|
|
|
If you are targeting different platforms, I heartily recommend to use boost::filesystem which abstracts this functionality in a very comfortable manner. If only one platform is targeted and this platform is windows, use designated Microsoft frameworks instead of this low level APIs.
|
|
|
|
|
by googling[^] you can get most of the answers without posting it again and can save time.
--
"Programming is an art that fights back!"
|
|
|
|
|
void CGetCurrentDirectoryDlg::OnBnClickedOk()
{
TCHAR tcPathName[100];
GetCurrentDirectory(100, tcPathName);
}
|
|
|
|
|
Hi...
I have created a polydraw.
CPaintDC dc (this);
CRect rect;
GetClientRect (&rect);
CPen pen (PS_SOLID, 0, RGB (0, 0, 255));
CPen* pOldPen = dc.SelectObject (&pen);
POINT aPoint3[7] = { 10, 10, 100, 150, 150, 150, 10, 100, 500,150,150, 100, 10, 10 };
BYTE types[7] = {PT_MOVETO, PT_LINETO, PT_LINETO, PT_BEZIERTO,PT_BEZIERTO, PT_BEZIERTO, PT_LINETO};
dc.PolyDraw(aPoint3,types,7);
dc.SelectObject (pOldPen);
Now i want to fill this polydraw. How can do that?
Any help will be appriciated...
Thanks...
G.Paulraj
|
|
|
|
|
Use CDC::FloodFill or CDC::ExtFloodFill .
|
|
|
|
|
Thanks super man.
FloodFill and ExtFloodFill asks HTC. how can get that variable from my code.
G.Paulraj
|
|
|
|
|
What do you mean by HTC?
You have to specify a point that lies within the bounding lines and the color of the lines.
You need to find some way to get this point.
|
|
|
|
|
Hi...
I am using visual studio 2008. The syntax for FloodFill is
FloodFill(HTC htc, int x, int y, COLERREF color);
if i use like FloodFill(10,100,RGB(255,255,255));,
there will be a syntax error like FlootFill does not take 3 arguments.
G.Paulraj
|
|
|
|
|
As mentioned by Superman, you have to use FloodFill from CDC, not the the global function (and it is HDC, not HTC). So, call FloddFill on the paint DC that you already have.
|
|
|
|
|
Thanks Cédric Moonen.
dc.FloodFill(1,1,RGB(255,255,255));
i have called like above. but full screen color has been changed. how to change the color of that particular polydraw area.
thanks...
G.Paulraj
|
|
|
|
|
The x and y has to be inside the polygon.
1, 1 lies outside in your case.
Try 15, 15.
|
|
|
|
|
is there any example to use calendar control with static text/edit box/combo box
when i click on static text/edit box/combo box the calendar contol should display. when i select any date it should hide. or when i click anywhere on dislog then calendar control should hide. which events are use for these actions.
which when i select any date which event tell me the selected date
|
|
|
|
|
|
friends .i am working in visual studio and learnng windows api. I complied a code and getting the following error..
error LNK2019: unresolved external symbol __imp__PlaySoundW@12 referenced in function _WndProc@16
fatal error LNK1120: 1 unresolved externals
i googled and found the solution to add a WINMM.lib file to my project.
i add this lib file at
"project property pages->Linker->General->Additional Library Directories"
but the error appears again and again.
can anyone please help..
|
|
|
|
|
Verify that you added the library under the right configuration (debug/release). You probably want to add it to all your configurations.
|
|
|
|
|
gateway23 wrote: project property pages->Linker->General->Additional Library Directories"
You should only specify the folder there, not the library itself. To specify that your project has to link with this lib file, you have to specify it into "Linker -> Input -> Additional Dependencies".
|
|
|
|
|
thanks Cédric Moonen ,, now my project plays sounds fine.
|
|
|
|
|
Hi,
Does anyone have any code snippets showing what I need to do in order to draw what usually goes to a DC onto a bitmap instead?
I am not being lazy, I am just into recycling
|
|
|
|
|
Drawing is always done to a device context.
To create a bitmap out of it, the device context can be saved as a bitmap.
I found one article on CP -
http://www.codeproject.com/KB/graphics/drawing2bitmap.aspx
|
|
|
|
|
Thanks Superman, that looks to be EXACTLY what I need to do. I did try searching the Code Project site first but I probably chose bad keywords.
|
|
|
|
|
Below is a code snippet that demonstrates creating a memory DC, calling functions that use std GDI funtions to draw onto the DC, extracting the BMP from the DC and doing something with it, and finally clean up:
<br />
BOOL DoChart(CallContextObj *pCallContextObj)<br />
{<br />
CDC oMemDC;<br />
CBitmap *pOldBmp;<br />
CBitmap oBmp;<br />
<br />
long lWidth = 300;<br />
long lHeight = 200;<br />
pCallContextObj->GetParameterValue(_T("ChartWidth"),&lWidth);<br />
pCallContextObj->GetParameterValue(_T("ChartHeight"),&lHeight);<br />
<br />
CRect oBmpSize(0,0,lWidth,lHeight);<br />
<br />
oMemDC.CreateCompatibleDC(NULL);<br />
int iOldMapMode = oMemDC.SetMapMode(MM_TEXT);<br />
<br />
CWindowDC dcScreen(NULL);<br />
<br />
oBmp.CreateCompatibleBitmap(&dcScreen,oBmpSize.Width(), oBmpSize.Height());<br />
<br />
pOldBmp = oMemDC.SelectObject(&oBmp);<br />
<br />
WORD wChartType = 88;<br />
pCallContextObj->GetParameterValue(_T("ChartType"),&wChartType);<br />
<br />
BOOL bRetval = FALSE;<br />
TCHAR caError[1024];<br />
_tcscpy(caError,_T("Invalid Chart Type"));<br />
<br />
switch (wChartType)<br />
{<br />
case 0:<br />
bRetval = DoLineChart(pCallContextObj,&oMemDC,caError,oBmpSize);<br />
break;<br />
<br />
case 1:<br />
bRetval = DoBarChart(FALSE,pCallContextObj,&oMemDC,caError,oBmpSize);<br />
break;<br />
<br />
case 2:<br />
bRetval = DoBarChart(TRUE,pCallContextObj,&oMemDC,caError,oBmpSize);<br />
break;<br />
<br />
case 3:<br />
bRetval = DoOpenHiLowCloseChart(pCallContextObj,&oMemDC,caError,oBmpSize);<br />
break;<br />
<br />
case 4:<br />
bRetval = DoPieChart(pCallContextObj,&oMemDC,caError,oBmpSize);<br />
break;<br />
}<br />
<br />
if (bRetval)<br />
{<br />
char caHeaders[1024];<br />
<br />
#ifdef UNICODE<br />
BYTE *cpBuf = (BYTE *)pCallContextObj->GetUTF8OutputBufferPtr();<br />
#else<br />
BYTE *cpBuf = (BYTE *)pCallContextObj->GetOutputBufferPtr();<br />
#endif<br />
<br />
long lQuality = 75;<br />
pCallContextObj->GetParameterValue(_T("ImageQuality"),&lQuality);<br />
<br />
long lDataSize = WriteImage(oBmp,cpBuf,pCallContextObj->GetOutputBufferSize(),caError,(DWORD)lQuality);<br />
if (lDataSize > 0)<br />
{<br />
pCallContextObj->SuppressHeaders();<br />
<br />
sprintf(caHeaders,"Content-Type: image/jpeg\r\nContent-Length: %d\r\n\r\n",lDataSize);<br />
<br />
if (pCallContextObj->ServerSupportFunction(HSE_REQ_SEND_RESPONSE_HEADER,"200 OK",0,(LPDWORD)caHeaders) || ::GetLastError() == 10054)<br />
pCallContextObj->WriteClient((LPVOID)cpBuf,(LPDWORD)&lDataSize);<br />
<br />
*cpBuf = 0;<br />
pCallContextObj->EraseContent();<br />
}<br />
else<br />
bRetval = FALSE;<br />
}<br />
<br />
oMemDC.SetMapMode(iOldMapMode);<br />
oMemDC.SelectObject(pOldBmp);<br />
<br />
oMemDC.DeleteDC();<br />
<br />
if (!bRetval)<br />
{<br />
pCallContextObj->StartContent();<br />
pCallContextObj->WriteTitle();<br />
pCallContextObj->WriteContent(_T("Error Converting Bitmap!<BR>"));<br />
pCallContextObj->WriteContent(caError);<br />
pCallContextObj->EndContent();<br />
}<br />
<br />
return TRUE;<br />
}
onwards and upwards...
|
|
|
|
|