|
comboy2080 wrote:
Can some one tell me the Win32 API fn() or fn()'s used to calculate the bandwidth consumption of our computer. I am on NT platform and using VC++6.0 compiler.
yeah there are some Good IPhelper Api's presents in the VC++ enviornment
Look in Index of MSDN for iphlpapi Module
or Here is the required Function that will help you
-->GetIfTable
or you can look for firewall Implementation by SUdhir MAngla at Cp.search for article by author for Sudhir Mangla
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hello everyone
What is the defference about _T("abc") and "abc"? Thank you.
-Freehawk
|
|
|
|
|
_T("abc") translate "abc" to unicode on unicode builds and remain "abc" on non unicode builds, see tchar.h
hope that helps, regards
|
|
|
|
|
As well as the above reply, you can also read this[^] article for a more detailed explanation (and other vital info on strings).
I Dream of Absolute Zero
|
|
|
|
|
Hi,
I need to modify a 16 color bmp and then save it as a seperate file. I loaded a 16 color 48x48 bmp file on DC using the LoadImage() and BitBlt() API. Using GDI functions, I change the display on the DC, say draw a line on the DC, on top of the image displayed. Now I need to capture the current DC ( bmp image + the changes,i.e., the line) and create a new BMP file.
For 256 color and 16 color BMP file, the new BMP created is a plain white imgage, if I load the image with 'LR_CREATEDIBSECTION' flag in LoadImage API. else I get am able to create the file, but the image size is different. For the 24 bpp the application is working fine. Where am i doing wrong. I am using the 'CreateCompatibleBitmap()' to create the bitmap from DC. Is there any other way?.
<br />
HBITMAP hBMP;<br />
RECT r;<br />
GetClientRect(GetDlgItem(hWnd,IDC_STATIC_1),&r);<br />
HDC memDC = CreateCompatibleDC ( pDC );<br />
hBMP = (HBITMAP)LoadImage(hResDll ,filename,IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);<br />
SelectObject ( memDC, hBMP );<br />
BitBlt(pDC,r.left ,r.top ,imgWidth,imgHeight ,memDC,0,0,SRCCOPY);<br />
DeleteObject(hBMP);
..............................
To capture the modified BMP from DC
.............................
<br />
RECT rc;<br />
GetClientRect(GetDlgItem(hWndDlg,IDC_STATIC_1),&rc);<br />
HDC hScreenDC = GetWindowDC(GetDlgItem(hWndDlg,IDC_STATIC_1)); <br />
HDC hmemDC = CreateCompatibleDC(hScreenDC); <br />
int ScreenWidth = rc.right;<br />
int ScreenHeight = rc.bottom;<br />
HBITMAP hmemBM = CreateCompatibleBitmap(hScreenDC, ScreenWidth ,ScreenHeight );<br />
SelectObject(hmemDC, hmemBM);<br />
bufLen= filesize;<br />
HGLOBAL hpxldata = GlobalAlloc(GMEM_FIXED ,imgWidth * imgHeight * 3 ); <br />
void * lpvpxldata = GlobalLock(hpxldata);<br />
<br />
BITMAPINFO bmInfo;<br />
bmInfo.bmiHeader.biSize = 40;<br />
bmInfo.bmiHeader.biWidth = imgWidth;<br />
bmInfo.bmiHeader.biHeight = imgHeight;<br />
bmInfo.bmiHeader.biPlanes = 1;<br />
bmInfo.bmiHeader.biBitCount = 24;<br />
bmInfo.bmiHeader.biCompression = 0;<br />
bmInfo.bmiHeader.biSizeImage = 0;<br />
bmInfo.bmiHeader.biXPelsPerMeter = 0;<br />
bmInfo.bmiHeader.biYPelsPerMeter = 0;<br />
bmInfo.bmiHeader.biClrUsed = 0;<br />
bmInfo.bmiHeader.biClrImportant = 0;<br />
BITMAPFILEHEADER bmFileHeader;<br />
bmFileHeader.bfType = 19778;<br />
bmFileHeader.bfSize = filesize; <br />
bmFileHeader.bfReserved1 = 0;<br />
bmFileHeader.bfReserved2 = 0;<br />
bmFileHeader.bfOffBits = 54;<br />
StretchBlt(hmemDC,0 ,0 ,imgWidth ,imgHeight,hScreenDC,0,0,ScreenWidth,ScreenHeight ,SRCCOPY);<br />
int nret = GetDIBits(hmemDC, hmemBM, 0, imgHeight, lpvpxldata, &bmInfo, DIB_RGB_COLORS);<br />
<br />
<br />
ImgBuffer = (void*)malloc(bufLen); <br />
memset(ImgBuffer, 0, bufLen); <br />
memcpy((char*)ImgBuffer, (char*)&bmFileHeader,14);<br />
memcpy((char*)ImgBuffer + 14, (char*)&bmInfo, 40);<br />
memcpy((char*)ImgBuffer+54, (char*)lpvpxldata,bufLen - 54); <br />
FILE *fn = fopen("e:\\vinaya\\testimg.bmp","w"); <br />
fn = fopen("e:\\NewImg.bmp","w");<br />
fwrite((char*) ImgBuffer ,sizeof(char), filesize, fn);<br />
fclose(fn);<br />
fn = NULL;<br />
<br />
int i = GlobalUnlock(hpxldata);<br />
DWORD size = GlobalSize(hpxldata);<br />
HGLOBAL h = GlobalFree(hpxldata);<br />
DeleteObject(hmemBM);<br />
DeleteDC(hmemDC);<br />
ReleaseDC(0,hScreenDC);<br />
return ;
The new image need to be same in file size, resolution, bpp except the modification in image data. Kindly help.
Thanks
~Vini
|
|
|
|
|
I want to change a menu item, if i click over "Pause" it must appear "Run", for example.
But how can i do this?
Thanks.
|
|
|
|
|
Assuming you are using MFC. Add a handler for the OnUpdate of the menu item. You will also need a state flag of some kind (say a bool m_bIsRunning)
So you will have something like
void CMyDoc::OnUpdateMenuItem(CCmdUI* pCmdUI)
{
:
if (m_bIsRunning)
pCmdUI->SetText(_T("Pause"));
else
pCmdUI->SetText(_T("Run"));
:
}
NOTE: You need to toggle m_bRunning when you select the menu item.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
an activeX control acess the oracle by ODBC interface,such as a windows application.coun't it realize? if can ,tell me how to do,Thanks a lot !!
|
|
|
|
|
|
How can, to you too.
I Dream of Absolute Zero
|
|
|
|
|
Hi,,,
|
|
|
|
|
what do u want buddy
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
First. I appreciate that you spend your time to read my question.
I have question about how to define an object array at private area.
For example: I have a class which is call base_class; I want to create a new class which is called
new_class; But I want to define base_class[50] in my new class. Could someone help me?
The following code is what I define in my new class;
class new_class
{
public:
// define some public function here.
private:
base_class datause[50];
};
I got wrong message when I create new_class object in my main program.
|
|
|
|
|
What error message did you get ?
Can you be a little bit more precise...
|
|
|
|
|
did you #include the declaration of base_class before declaring new_class
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi all,
Now I have image items in thumbnail view in CListCtrl(it looks like Explorer), and I want to implement drag and drop image items in the control. Could you tell me the way?
Thank you!
phucfbk@yahoo.com
|
|
|
|
|
|
Hai Frens
My application is a form based application and has an combo box disabled at the initial state. . .I need to enable that combo on clicking a menu item.
Can any one suggest me how to do that ?
I need another suggestion for selecting multiple rows in flexgrid by pressing Ctrl key.
Thanx
|
|
|
|
|
I want my SDI application to have always the same size and position on screen.
Resizing and Moving is disabled by the code below; which is inserted in OnCreate of main frame
CMenu* pTopMenu = GetSystemMenu(FALSE);
if(pTopMenu != NULL)
{
pTopMenu -> RemoveMenu(SC_SIZE, MF_BYCOMMAND); //No ReSize
pTopMenu -> RemoveMenu(SC_MOVE, MF_BYCOMMAND); //No Move
}
for Resize and move above code works fine!
BUT for size let us look at PreCreatewindow of Mainframe
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style &= ~FWS_ADDTOTITLE;
cs.x = 0;
cs.y = 77;
cs.cx = 1000;
cs.cy = 500;
return TRUE;
}
the above code didn't work; if i change one value in the structure the other is automatically changed/ignored, gives unexpected positioning. May be some sort of aspect ratio problem which windows might be maintaining internally.
Another soloution is to use Move in the initinstance but i want to avoid it since it first shows main frame at the 0,0 position and then moves it to required postion, with a slight but observable delay.
Please help to solve the above problem.
|
|
|
|
|
How to retrieve the list of public folders in an exchange server using ADSI programming(vc++).Please give the code.
|
|
|
|
|
hi all,
I have created a DialogBase Application using MFC ,Visual C++..
Now I want to create Web Interface to my Application..How am I going to do that ?..
If any one know that please reply me..
Thanks in advance..
|
|
|
|
|
If it's a dialog application just use the ActiveX web browser control.
How do I print my voice mail?
|
|
|
|
|
Your question is a little confused.
Are you wanting to create a web interface that runs on a web-server and users access via a browser? Or do you want to emulate the web-look and feel like Microsoft Money attempts to.
If you want to run your app off a web-server, then you'll need to look into one of the web technologies such as ASP.NET or PHP or ASP.
Michael
CP Blog [^]
|
|
|
|
|
Does anyone know if it is possible to cast a GDIPlus *Image to a GDIPlus Bitmap? I can't seem to figure this one out.
Forever Developing
|
|
|
|
|
i have serial class library.
i use read data function.
this is following.
//Serial.cpp
////////////////////////
int CSerial::ReadData( void *buffer, int limit )
{
if( !m_bOpened || m_hIDComDev == NULL ) return( 0 );
BOOL bReadStatus;
DWORD dwBytesRead, dwErrorFlags;
COMSTAT ComStat;
ClearCommError( m_hIDComDev, &dwErrorFlags, &ComStat );
if( !ComStat.cbInQue ) return( 0 );
dwBytesRead = (DWORD) ComStat.cbInQue;
if( limit < (int) dwBytesRead ) dwBytesRead = (DWORD) limit;
bReadStatus = ReadFile( m_hIDComDev, buffer, dwBytesRead, &dwBytesRead, &m_OverlappedRead );
if( !bReadStatus )
{
if( GetLastError() == ERROR_IO_PENDING )
{
WaitForSingleObject( m_OverlappedRead.hEvent, 2000 );
return( (int) dwBytesRead );
}
return( 0 );
}
return( (int) dwBytesRead );
}
//testdlg.cpp
////////////////////////////
char lpBuffer[500];
int nBytesRead = serial.ReadData(lpBuffer, 500);
m_receivebyte=nBytesRead;
CString m_strreceive;
m_strreceive.Format("%d",nBytesRead);
if (m_receivebyte!=0)
{
AfxMessageBox("Receive Data "+m_strreceive);
}
/////////////////////////////
i want to know how to get string data from comport.
(for example - please enter string)
now,i receive only int data
(for example - 123)
please answer my application problems..
|
|
|
|
|