|
Thanks for your reply. No, I am not sure.
Since I can locate code to track almost everything except available video RAM, I wanted to be complete, and that was just one of my suspect functions potentially leaking memory or GDI handles or 'somethihng' out there that is causing other GDI calls to fail.
I did find this useful link for tracking GDI objects:
Detect and Plug GDI Leaks in Your Code with Two Powerful Tools for Windows XP
http://msdn.microsoft.com/msdnmag/issues/03/01/GDILeaks/default.aspx
|
|
|
|
|
Blake Miller wrote:
determine how much of the video RAM
One way to do so is create a directdraw7 interface and use IDirectDraw7::GetCaps to get the amount of free video memory.
John
|
|
|
|
|
Hello
i've got a char **reser, and i pass it to a function like this:
<br />
char **reser;<br />
ParsearReservadas(ArchReser,reser,&cant,vec);<br />
the function header is:
<br />
void ParsearReservadas(FILE *FileReser, char **reser,int *cantpalres, int *vec)<br />
i write something to the char ** inside the function (after using malloc), and i print it and it's ok, but when i return to main i print it and i can't see it.
this piece of code works inside the function but doesn't work in main
<br />
for (i=0;i<=(cant);i++)<br />
printf ("%s\n",reser[i]);<br />
what's the problem ?
thanks!
|
|
|
|
|
kfaday wrote:
i write something to the char ** inside the function, and i print it and it's ok, but when i return to main i print it and i can't see it.
That's how function parameters work. To make the change visible to the caller, make the parameter a reference:
void ParsearReservadas(FILE* FileReser, char**& reser, ... );
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Windows troubleshooting: Reboot first, ask questions later.
|
|
|
|
|
|
How can i save BMP files as frams to AVI file?
i can get Frames from AVI and i Put them into BMP files
how can i add bMp to AVI?
|
|
|
|
|
Someone may have answered this already, but I could not find one. So a pointer to an already answered article. Or an answer would be appreciated.
I have downloaded a couple of the ComboBox examples and they work as advertised when I use the demos provided. However, when I incorporate the code into my own project it does not perform the same way. Specifically When I run the demos the ComboBox will drop down with a complete list of selections. When I click on the ComboBox in my project (6.0) I can't get the complete list. I get a single drop Item. So can anyone tell me how I can make the Visual C++ 6.0 project provide a complete drop down list with all items showing? I.E. When you click on the ComboBox Drop button how do I get all items to show instead of just a single item?
Many thanks for any help.
Charlie
|
|
|
|
|
If I understand you correctly...
A combobox is comprised of two controls: an edit control and a dropdown listbox. For the most part, they act seamlessly together. However, at design time, they can be a bit quirky. In the resource editor, click the down arrow on the right side of the combobox. This will allow you to size the listbox part of the control.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
THANK YOU! Sometimes it is the simplest things that get you. I have been trying for days to figure this one out. Thanks to you I am now back on track!
Thanks a million!
Charlie
|
|
|
|
|
Hello Folks!
I was wondering if someone can help me in this issue. I'm having problems setting focus on a window control. Specially, if the control is a Button or Edit, I call SetFocus to it, but Windows don't draw the focus on the control. So, seems that the control don't has the focus, but it do However, it happens with some versions of WindowsXP and Win2000. The most interesting thing is even if we click the control with the mouse the control still doesn't seem to be focused . My application is Win32 C, using only Platform SDK (I mean, it is a C application, not C++).
I do something like this:
HWND Controls[NUM_CONTROLS];<br />
<br />
void InitControls(void);<br />
<br />
LRESULT CALLBACK KeyboardProc(<br />
int nCode,<br />
WPARAM wParam,<br />
LPARAM lParam<br />
)<br />
{<br />
switch(wParam)<br />
{<br />
<br />
case VK_TAB: <br />
SetFocus(Controls[nNextControl]);<br />
UpdateWindow(hThisWindow);<br />
return TRUE;<br />
}<br />
return CallNextHookEx(hkHook, nCode, wParam, lParam);<br />
}<br />
Thanks for any help on this.
Regards,
__________
Chulips
|
|
|
|
|
Boy, i know ur problem and the exact solution.
First of all, you cant use SetFocos to focus child items on the MAIN WINDOW. You have to use a technique called WINDOW SUBCLASSING to solve it.
If you have access to the book "Programming windows" by charl's petzold, go through Window subclassing in chapter 9.
If u dont hav the book, tell me, i ll try to give a short tutorial
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
I can't do it even if I'm working with dialogs ????
Well, I know this book, but I don't have how to access it... If you can help me with some resources, I would be glad.
Thanks a lot.
__________
Chulips
|
|
|
|
|
Ignore the other poster. This is a feature of Windows 2000 and XP - focus is only drawn when the user actually interacts with the UI using the keyboard.
Note: I'm talking about focus rectangles, the dotted lines that appear inside the button. See later for information on the default push button highlight and automatically selecting the text in an edit control.
To get the UI to draw focus rectangles in response to a keyboard operation, Windows sends your window WM_CHANGEUISTATE and WM_UPDATEUISTATE messages. To get the standard controls to do their stuff, simply pass these messages along to DefWindowProc (which you should normally be doing anyway).
If you have a custom control that you want to draw focus rectangles on, handle these messages.
If you're dealing with a dialog, send a WM_NEXTDLGCTRL message to the dialog instead of using SetFocus . The dialog box code itself deals with selecting the text in an edit control and setting the default button, but it doesn't see the notifications to the child controls.
If you have a modeless dialog (created with CreateDialog or the Indirect /Param variants), your message loop needs to call IsDialogMessage to get this behaviour. You can also use IsDialogMessage with a regular window to get the same behaviour.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hello Mike!
Your tip has helped me a lot! IsDialogMessage was my problem (I wasn't calling it...) But now, I have the same problem for static controls. There're two controls (static texts) that should receive the focus, since I'm treating them as links. So, I want tabstops and focus drawing on them. But Windows makes only tabstops, but doesn't draw it. Still, seems that I can't process WM_KILLFOCUS, WM_SETFOCUS or even WM_CHANGEUISTATE and WM_UPDATEUISTATE, because they are processed by IsDialogMessage. Do you have any comment about it? How do I get focus visible on those controls?
Regards,
Felipe
__________
Chulips
|
|
|
|
|
Hello Everyone,
In my current code, A program calls a function in B program using "Invoke" method. B program has an exposed COM interface. It works fine. Then I added another exposed method in B program, but everytime I call it, there is an error. I tried to go thru the code. In program B, the code for the two function are exactly the same. What should I do?
Thanks a lot in advance.
Bin
|
|
|
|
|
More information on the error would help!
Ant.
|
|
|
|
|
I can make wql requests but how can I place the requested value in a C++ variable, e.g. query = (SELECT capacity FROM Win32_PhysicalMemory WHERE BankLabel = "Bank0") and then get the value "capacity" and put it into an int variable in the C++ app.
Cheers for any help in advance.
Dave.
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Do these articles help any?
http://www.codeproject.com/csharp/wmi.asp?target=select
http://www.codeproject.com/useritems/PrntJobControllerUsingWMI.asp?target=select
Or this thread?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi there,
I am trying to implement a privacy control functionality to block cookies, somethign similar to what IE 6.0 is doing now. I can get to teh point of reading them throught IHTMLDocument interface, btu have not figured out how to stop them from writing onto the cookie folder.
has anybody done anything similar to thsi or can you suggest me soem ideas in this regard?
Thank you,
subbu
|
|
|
|
|
Hi Everybody,
I am tryieng to load bitmap dynamically from a perticular memory location. I am giving the patch of the bitmap to CBitmap::LoadBItmap(...) member function. But it is not working. I think CBitmap::LoadBItmap(..) does not take the patch of the bitmap. I think there is another procedure to achieve it. If any one konws how to load the bitmap dynamically. please let me know.
bbye
Salman
Live and Let live
|
|
|
|
|
CreateDIBSection .
Next!
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Well, i am not about MFC, but using API u can do it the following way. Go through the code and i hope you can easily port it to MFC.
If you want to dynamically load a bitmap included as a resouce, use the following code:
<br />
HDC hdc,bdc;<br />
bdc=CreateCompatibleDC(hdc);<br />
hBmp=LoadBitmap(gloInst,"BMP_SYSTRAY");
SelectObject(bdc,hBmp);<br />
BitBlt(hdc,0,0,200,100,bdc,0,0,SRCCOPY);<br />
DeleteDC(bdc);
The potential problem with this approach is that you cant pick bitmaps from the disk(any file) and bitmaps that have more than 256 colors.
Alternatively if you want to dynamically load any bitmap of any size and any bit-depth, use the following code:
When you process the WM_PAINT message, use the following code to draw the bitmap:
static BITMAPFILEHEADER * pbmfh ;
static BITMAPINFO * pbmi ;
static BYTE * pBits ;
static int cxDib, cyDib ;
static TCHAR szFileName [MAX_PATH], szTitleName [MAX_PATH] ;
HDC hdc ;
PAINTSTRUCT ps ;
WM_PAINT://For MFC use OnPaint(){//insert the following code}
hdc = BeginPaint (hwnd, &ps) ;
pbmfh = DibLoadImage (szFileName) ;//DEFINITION FOR THIS IS GIVEN BELOW, "szFileName is the PATH OF THE ".BMP" FILE e.g."c:\\test.bmp"
if (pbmfh == NULL)
{
MessageBox (hwnd, TEXT ("Cannot load DIB file"),"error",0) ;
return 0 ;
}
// Get pointers to the info structure & the bits
pbmi = (BITMAPINFO *) (pbmfh + 1) ;
pBits = (BYTE *) pbmfh + pbmfh->bfOffBits ;
// Get the DIB width and height
if (pbmi->bmiHeader.biSize == sizeof (BITMAPCOREHEADER))
{
cxDib = ((BITMAPCOREHEADER *) pbmi)->bcWidth ;
cyDib = ((BITMAPCOREHEADER *) pbmi)->bcHeight ;
}
else
{
cxDib = pbmi->bmiHeader.biWidth ;
cyDib = abs (pbmi->bmiHeader.biHeight) ;
}
SetDIBitsToDevice (hdc,
0, // xDst
0, // yDst
cxDib, // cxSrc
cyDib, // cySrc
0, // xSrc
0, // ySrc
0, // first scan line
cyDib, // number of scan lines
pBits,
pbmi,
DIB_RGB_COLORS) ;
EndPaint (hwnd, &ps) ;
BITMAPFILEHEADER * DibLoadImage (PTSTR pstrFileName)<br />
{<br />
BOOL bSuccess ;<br />
DWORD dwFileSize, dwHighSize, dwBytesRead ;<br />
HANDLE hFile ;<br />
BITMAPFILEHEADER * pbmfh ;<br />
<br />
hFile = CreateFile (pstrFileName, GENERIC_READ, FILE_SHARE_READ, NULL,<br />
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL) ;<br />
<br />
if (hFile == INVALID_HANDLE_VALUE)<br />
return NULL ;<br />
<br />
dwFileSize = GetFileSize (hFile, &dwHighSize) ;<br />
<br />
if (dwHighSize)<br />
{<br />
CloseHandle (hFile) ;<br />
return NULL ;<br />
}<br />
<br />
pbmfh = malloc (dwFileSize) ;<br />
if (!pbmfh)<br />
{<br />
CloseHandle (hFile) ;<br />
return NULL ;<br />
}<br />
<br />
bSuccess = ReadFile (hFile, pbmfh, dwFileSize, &dwBytesRead, NULL) ;<br />
CloseHandle (hFile) ;<br />
if (!bSuccess || (dwBytesRead != dwFileSize) <br />
|| (pbmfh->bfType != * (WORD *) "BM") <br />
|| (pbmfh->bfSize != dwFileSize))<br />
{<br />
free (pbmfh) ;<br />
return NULL ;<br />
}<br />
return pbmfh ;<br />
}
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
Hi
You can try to use the loadimage function ?
d
|
|
|
|
|
I am a VC++ freshman, pls help me! Thanx a lot!!
How can I derive a MFC class from CMenu thus I can use Message Reflection ?
"Insert" Menu -> "New Class"
but I cannot see CMenu (and many other classes) in the "Base Class" edit control!!!!!
To be or not to be!
|
|
|
|
|
You could select CObject from the list, then when the class is created replace all CObject references with CMenu.
Otherwise generate a generic class based on CMenu and do all the message stuffs manually.
Ant.
|
|
|
|
|