|
hi, below is my on draw...
it works fine as below...
code:
--------------------------------------------------------------------------------
void CEditorView::OnDraw(CDC* dc)
{
CMemDC pDC(dc);
OnPrepareDC(pDC);
CEditorDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here - use pDC
//as the device context to draw to
//
//Set the mapping mode to LOENGLISH
//
pDC->SetMapMode(MM_LOENGLISH);
//
//Convert arguments to coordinates to MM_LOENGLISH units.
//
CSize szTemp;
szTemp.cx = pDoc->GetGridX();
szTemp.cy = pDoc->GetGridY();
pDC->DPtoLP(&szTemp);
//
// then draw the grid lines
//
CRect clipBoxRect;
pDC->GetClipBox(&clipBoxRect);
for(int x = 10 ; x <= pDoc->GetGridX() ; x += 10) {
pDC->MoveTo(x, -10);
pDC->LineTo(x, -pDoc->GetGridY());
}
for(int y = -10 ; y >= -pDoc->GetGridY() ; y -=10) {
pDC->MoveTo(10, y);
pDC->LineTo(pDoc->GetGridX(), y);
}
}--------------------------------------------------------------------------------
it works perfectly fine as below....
now the problem is i wanan add this to my above code
code:
--------------------------------------------------------------------------------
//
//Draw the squares
//
/*for(int i = 0 ; i < 500 ; i ++) {
for(int j = 0 ; j < 750 ; j ++) {
COLORREF color = pDoc->GetSquareColor(i, j);
CBrush brush(color);
int x1 = (j * 10) + 10;
int y1 = (i * -10) - 10;
int x2 = x1 + 10;
int y2 = y1 - 10;
CRect rect(x1, y1, x2, y2);
pDC->FillRect(rect, &brush);
}
}*/--------------------------------------------------------------------------------
when i do this...
all the processing power of the processor is eaten up by the processor....
can someone pls tell me a solution by which i can incorporate the above code to my View's OnDraw such that i can still retain my processing power????
tks a lot...
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
"For God so loved the world that He gave His only begotten Son, that whoever believes in Him should not perish but have everlasting life."
John 3:16
"Therefore you also be ready, for the Son of Man is coming at an hour you do not expet."
Luke 12:40
|
|
|
|
|
It is not advisable to have a lenghty operation like yours within the UI thread because it gets blocked.
Look up worker threads in MSDN.
Peter Molnar
|
|
|
|
|
help me,
my question is :
i can't get the text in CComboBox that i input when the program is run
(CComboBox m_DBName);
int index=-1;
index=m_DBName.GetCurSel();
//if i input "sdfs",the next cause a error
str=m_DBName.GetCurrentText();
|
|
|
|
|
|
no ,GetLBText() can't,i have try,
my porpuse:
get the user input not the user select
|
|
|
|
|
GetWindowText
Happy Gemini
|
|
|
|
|
hi,no,GetWindowText is diseable in CComboBox
|
|
|
|
|
What are you talking about ????? GetWindowText is inherited from the parent CWnd class! So that works !!
Just use this syntax:
CString Buffer;<br />
GetDLGItem(IDC_YOURCOMBO)->GetWindowText(Buffer);
(or use m_YourCombo.GetWindowText(Buffer) if it is a member variable of your class).
And that will work !!
|
|
|
|
|
agree "cedric moonen"
Happy Gemini
|
|
|
|
|
I posted a thread about how to detect cdrw and MO,but it didn't get appropriate answer.I just use the way as showed below to do it.
/****************************************************
BOOL GetDriveGeometry(HANDLE hDevice, PGET_MEDIA_TYPES pMediaTypes)
{
DWORD dwOutBytes;
BOOL bResult;
bResult = ::DeviceIoControl(hDevice,
IOCTL_STORAGE_GET_MEDIA_TYPES_EX,
NULL, 0,
pMediaTypes, MEDIA_INFO_SIZE,
&dwOutBytes,
(LPOVERLAPPED)NULL);
return bResult;
}
*****************************************************
I can get all CD driver(including cdrom and cdrw,but just as CD driver) with GetDriveProperty.The reason why I get cdrw as CD driver because their value of
"pMediaTypes->MediaInfo[0].DeviceSpecific.DiskInfo.MediaType" all is "CD_ROM".
I want to know the driver's r/w attribute by its parameter of
"pMediaTypes->MediaInfo[0].DeviceSpecific.DiskInfo.MediaCharacteristics" ,but result is still "read only".
please give me some suggestion.
thank you.
Happy Gemini
|
|
|
|
|
Hi all,
How to convert hWnd to CWnd
Help plzz....
Thanks in Advance
Chinna
|
|
|
|
|
|
HWND hWnd;
CWnd *pWnd;
//for dialog item say...
GetDlgItem(IDC_PICexample,&hWnd); // IDC_PI.. is the id for your dialog
pWnd = CWnd::FromHandle(hWnd);
//and we are done...
i hope you wanted the same..if you need more information, please do let me know!!!
|
|
|
|
|
hi,
i m writing a code to enumerate network & local printer in win98 client m/c, the printer driver is installed in my own win 98 client m/c. the same driver is installed in server where the printer is connected.i want to get the printer from the server(network printer or remote printer)....
here is some bit of code to enumerate...
the network printer attribute should be 16 but i m getting 84 value ... WHY ???. sometime i m getting 1108 value for the same network printer....??
code ....---->>
void PrinterRpt9x()
{
BOOL ret1;
printersetting=true;
DWORD i;
PRINTER_INFO_5* pPrint=NULL;
DWORD pcbNeeded=0,pcReturned=0;
HPRINTMUTEX= CreateMutex(NULL,FALSE,NULL);
ret1=EnumPrinters(PRINTER_ENUM_LOCAL,NULL,5,NULL,pcbNeeded,&pcbNeeded,&pcReturned);
//Windows 95: Also enumerates network printers
// because they are installed locally.
pPrint=(PRINTER_INFO_5 *)GlobalAlloc(GPTR,pcbNeeded);
ret1=EnumPrinters(PRINTER_ENUM_LOCAL,NULL,5,(LPBYTE)pPrint,pcbNeeded,&pcbNeeded,&pcReturned);
for(i=1;i<=pcReturned;i++)
{
if(pPrint->Attributes == PRINTER_ATTRIBUTE_NETWORK)
{
_beginthread(printdata9x,0,pPrint->pPrinterName);
}
if(pPrint->Attributes == PRINTER_ATTRIBUTE_LOCAL)
{
_beginthread(printdata9x,0,pPrint->pPrinterName);
pPrint++;
if(pPrint)
GlobalFree(pPrint);
}
}
then i m enumerating the jobs in queue in a thread and creating log file for each print command...
please help in this regard
guide me how to avoid this error ???
in win32 api..
regards
skpanda
|
|
|
|
|
I can get the smtp server address from an email address by using DnsQuery() function.But I wonder wether I can get the pop3 server address or not.
If u can, tell me how. Thanks.
|
|
|
|
|
No, the pop3 server may be on a different machine entirely. Typically ISPs name the machine 'pop.something.com', but thats just an arbitrary naming convention rather than a standard.
|
|
|
|
|
Thank you first!
Rap off for you,for me,for our human.
|
|
|
|
|
stop posting every question twice!!
Don't try it, just do it!
|
|
|
|
|
Take a look at the Windows Multimedia library of the PlatformSDK, functions like waveInStart, waveInStop, waveOutOpen , waveOutClose
Peter Molnar
|
|
|
|
|
Hi,
I am using MSvc++ 6.0 and I had creat one application in MFC dialoge based using DX9 Sdk .
Now i Want to add this MFC dialoge based application to my new project But when I am adding this code to new project DX9's Class Information Doesn't Coming with and giving me lot of error of class.
I want to add DX9's class to New App. How can i do ?
So any one suggest good trick to do this ?
|
|
|
|
|
Check
- What is your needed header files
- What is your needed static linked libraries (*.LIB)
- What is your needed dynamic linked libraries (*.DLL)
- Or needed COM or ActiveX object (VC6 has some functions to insert the component into your project) in Project - Add To Project
Most of these stuff are avail in MSDN.
I guess there is no quick trick for that.
Hope this helps
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I am having difficulty in adding a getline functions data to a vector, can anyone tell me how to achieve it by getting all the lines and putting them one by one into the vector's elements? I would appreciate any help that I would get, Please help because I've been playing with this one issue for a couple of days and can't seem to overcome this.
|
|
|
|
|
<small><b>Snyp wrote:</b></small>
<i>can anyone tell me how to achieve it by getting all the lines and putting them one by one into the vector's elements?</i>
std::ifstream file(@"c:\myFile.txt");
vector<string> myVec;
string line;
while (file.good())
{
getline(file, line);
myVec.push_back(line);
}
something like that.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|
Um... no.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|