|
The question seemed to be how to do the swap whitout using a secondary variable. Personally I prefer a temporary variable and use the XOR method in heavy recursion situations only.
I agree that "x^=y^=x^=y;" seems more like a method of exaggerate ones technical knowleadge than a useful technique - thus the "magic" comment.
Cheers
/moliate
The corners of my eyes catch hasty, bloodless motion -
a mouse?
Well, certainly a peripheral of some kind.
Neil Gaiman - Cold Colours
|
|
|
|
|
How to detect if a window is being minimized?
WM_ACTIVATE only seems to say if it's leaving minimized mode + just normal (de)activation.
|
|
|
|
|
Take a look at the WM_SYSCOMMAND message. If the wParam parameter is SC_MINIMIZE , then the window is about to be minimized.
|
|
|
|
|
Try using the Spy++ utility (found in the VC6 pkg). It's useful for watching the messages that go by when a user action takes place.
Software Zen: delete this;
|
|
|
|
|
I've tried the code on MSDN but that doesen't give me any filters. I was told it may be because i hadn't performed a RenderFile action on the IGraphBuilder. But isn't there another way of just enumerating all the available filters on the system? Here's my code, when it comes to the pEnum->Next procedure for the first time, it returns S_FALSE which means that the number of filters requested couldn't be found.
IGraphBuilder *pGraph = NULL;
IEnumFilters *pEnum = NULL;
IBaseFilter *pFilter = NULL;
ULONG cFetched;
CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder,(void**)&pGraph);
pGraph->EnumFilters(&pEnum);
while((err = pEnum->Next(1, &pFilter, &cFetched)) == S_OK)
{
FILTER_INFO fiFilterInfo;
char szFilterName[256];
pFilter->QueryFilterInfo(&fiFilterInfo);
WideCharToMultiByte(CP_ACP, 0, fiFilterInfo.achName, -1, szFilterName, 256, 0, 0);
SendMessage(GetDlgItem(ghWnd, IDC_FILTERS), LB_INSERTSTRING, -1, (LPARAM)szFilterName);
fiFilterInfo.pGraph->Release();
pFilter->Release();
}
pEnum->Release();
pGraph->Release();
CoUninitialize();
So i'm asking if there's a way to enumerate all the available filters on the system.
All help appreciated
-Rune Svendsen
|
|
|
|
|
The code you've got lists the filters of an empty IGraphBuilder (that is, none). RenderFile fills that IGraphBuilder with the filters necessary to render a given file. As for enumerating all the filters present in the system, check MSDN article Using the System Device Enumerator[^] (provides samples).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thankyou. Do you know how i add a filter to IFilterGraph if i only know the name of the filter?
-Rune Svendsen
|
|
|
|
|
Using VC6 it was easily possible to create a MFC-VC6 appl. and link MFC statically. The apps only depended on Kernel32.dll, User32.dll,...
Doing the same with VC7 or even converting such a project from VC6 to VC7 results in additional dependencies to SHLWAPI.dll, OELAUT.dll and OLEACC.dll.
How can I remove the dependencies to these DLLs, even linking with /opt:ref /opt:noicf doesn't help.
Any idea on howto make VC7 work like VC6 in this aspect is very much appreciated.
Rainer
|
|
|
|
|
Rainer
i too have noticed those dependencies, but don't think shlwapi and oleaut create particular problems
as far as oleacc.dll i suggest you to check out:
http://www.codeproject.com/cpp/oleaccproxy.asp[^]
basically an oleproxy or, better, a delayed loading dll, seems to be a recommended practice
maybe you could use this way also with the other 2 dlls
hope this helps
best regards
|
|
|
|
|
This helps
thank you
Rainer
|
|
|
|
|
How can I draw a transparent Icon without using DrawIcon function. I don’t want to use DrawIcon because it didn’t limit the width and height of the Icon in the DC. So I need a method that can draw a transparent icon within certain width and height.
Thank you
|
|
|
|
|
This is just a shot in the dark but have you checked out the functions in CImageList? Or if you are not using MFC then the corresponding ImageList_XXX functions?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I tried CimageList::DrawIndirect but it does not clip the icon, it draws it according to the width and height values passed in the parameter, so if I passed a smaller height the icon will be shrank to fit this height. What I need is to clip the icon according to the height and width I need.
Thank You
|
|
|
|
|
DrawIconEx accepts size arguments. I don't know if they use that to stretch the icon or to clip it. You could also try using the DrawState function. It draws an icon as a specified location and in a particular size.
Software Zen: delete this;
|
|
|
|
|
DrawIconEx does not clip the icon, it draws it according to the width and height values passed in the parameter, so if I passed a smaller height the icon will be shrank to fit this height. What I need is to clip the icon according to the height and width I need. DrawState does not clip the icon as well, it draw it all although I need it to be half drawn.
Thank You
|
|
|
|
|
You could do the following:
- Create a bitmap the same size as the icon, using
CreateCompatibleBitmap . - Create a memory device context compatible with the final destination DC using
CreateCompatibleDC . - Select the bitmap from step 1 into the memory device context.
- BitBlt from the final destination DC to the memory device context. This copies the background from the destination into the memory DC.
- Draw the icon into the memory DC using
DrawIcon . The icon has now been drawn (including transparency) onto the background, in the memory DC's bitmap. - BitBlt from the memory DC to the final destination DC, setting the destination size to clip the image as desired.
I know this seems somewhat laborious, but this should do the trick. Good luck.
Software Zen: delete this;
|
|
|
|
|
This solved my problem.
Thank you
|
|
|
|
|
and with cximage[^]?
The CxImage::Draw( ) method has a pClipRect parameter to limit the painting region.
|
|
|
|
|
How can I position a window to the bottom of a MDI client window, but above any statusbars/toolbars it has down there?
I got it done up to the part about client window, but the status/toolbars... no idea
I'm using MFC.
|
|
|
|
|
Hmmm. Using the MDI client window as a starting point, enumerate the client's child windows using EnumChildWindows , find the position of the free space within the client area from the positions of the child windows (which should include status and tool bars).
Software Zen: delete this;
|
|
|
|
|
QUESTION 1:
How do I deallocate the memory for input/output BSTRs from a VB client? ASP client? I cannot call SysFreeAlloc(...) from anywhere except in a C++ client.
Here's the idl for the method exposed by the interface:
[id(1), helpstring("method GenQuery")] HRESULT GenQuery([in] BSTR bstrParam, [out, retval] BSTR * bstrSQL);
QUESTION 2:
Do I need to Destroy my COM server object/instance? It's an inprocess dll-Apartment(both) ATL COM server.
Here's code for a VB client:
Private Sub btnQueryGen_Click()
Dim objQueryGen As QUERYGENALPHALib.QueryGenerator
Set objQueryGen = New QueryGenerator
Dim strSQL As String
strSQL = objQueryGen.GenQuery(Me.txtParam.Text)
Me.txtSQLQuery.Text = strSQL
'I cant objQueryGen = Nothing (runtime error 438: Object does not support this method or property)
End Sub
QUESTION 3 - destroy COM server?
What about from ASP?
norm
|
|
|
|
|
VB and VBScript handle all of that for you, AFAIK.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
what do u mean? what do u mean that VB.NET will handle all that...?
and what's "AFAIK"
norm
|
|
|
|
|
All scripting languages will do this for you. And yes, both VB and VB.NET will also. It helps however to clear the reference to your COM object after it has been used but you must use the Set keyword there also:
<br />
Set myObject = Nothing<br />
AFAIK : As Far As I Know
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Syntactically, is the keywork "Set" redundant, u think?
norm
|
|
|
|