|
Hi all,
As it is the first time I use doc window, I don't know how to show the child doc window by pressing a button in parent dialog. I know that in dialog mode to call a child dialog, I can use child.DoModal(), but how about a child doc window under a main dialog?
pls help
thx
|
|
|
|
|
I use CFormView as the view's base class in a MDI program. Run
the program and select File->New from the menu. Then newly
created view pops up in a strange appearance. It's extent covers
only the topleft part of the MainFrame's client area, while its window top bar is invisible just like it is in its maximized status.
Why? And how to fix it?
|
|
|
|
|
I am trying to save a BMP to file from the ISampleGrabber Interface
In this section of code I 'am basically grabbing the image from a source using the GetCurrent buffer method from ISampleGrabber. I think that i successfully get the buffer, but when i try and save it to BMP file calling the methd WriteDIB(), something goes wrong!! It creates a file with data inside it but the image is not a valid bmp and therefore it does not open by clicking on it.
Any help please....
pMediaFilter->SetSyncSource(NULL);
pControl->Run();
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);
long cbBuffer = 0;
hr = pGrabber->GetCurrentBuffer(&cbBuffer, NULL);
char *pBuffer = new char[cbBuffer];
if (!pBuffer)
{
error("out of memory\n");
return 1;
}
hr = pGrabber->GetCurrentBuffer(&cbBuffer, reinterpret_cast<long*(pBuffer));
if(SUCCEEDED(hr))
{
printf("got the buffer!\n");
}
<font color="green">
if(WriteDIB("C:\\EMILIANO.bmp", pBuffer, cbBuffer))
{
printf("created file\n");
}
}<font color="green">
<font color="green">
bool WriteDIB(LPTSTR szFile, HANDLE hDIB, long size)
{
BITMAPFILEHEADER hdr;
LPBITMAPINFOHEADER lpbi;
if (!hDIB)
return false;
FILE* file=0;
file = fopen(szFile,"wb");
if(!file)
return false;
lpbi = (LPBITMAPINFOHEADER)hDIB;
int nColors = 1 << lpbi->biBitCount;
if (nColors > 256)
nColors = 0;
hdr.bfType = ((WORD) ('M' << 8) | 'B');
hdr.bfSize = GlobalSize (hDIB) + sizeof( hdr );
hdr.bfSize = size + sizeof( hdr );
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = (DWORD) (sizeof( hdr ) + lpbi->biSize +
nColors * sizeof(RGBQUAD));
fwrite(&hdr, 1, sizeof(hdr),file);
fwrite(lpbi, 1, size ,file);
fclose(file);
return true;
}
|
|
|
|
|
Are you sure that the data arriving at your filter is in the correct format?
Make sure that you don't need to insert any intermediate filters to get the sample in RGB24. One of the easiest ways to check is to use graphedit - see what filters the DirectShow smart connect process is using.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Thank you for your response. I have never used Graph edit, I'am just having a look at now,
But what i did do is this in the mean time
AM_MEDIA_TYPE mt;
ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
mt.majortype = MEDIATYPE_Video;
mt.subtype = MEDIASUBTYPE_RGB24; <font color="green">setting the sub_type</font>
I am not sure if this is what you meant.. The out come of this is that the file size has got smaller but i still can not open the image.
Any more ideas?? - thanks in advanve -
|
|
|
|
|
Emiliano wrote:
I am not sure if this is what you meant
I'm guessing no it's not. You need to look at the code in the checkmediatype functions.
Emiliano wrote:
The out come of this is that the file size has got smaller but i still can not open the image.
All I can think of is try to find a piece of sample code which you are sure writes bitmaps out correctly - or test that the code you have works. I know I've got one somewhere but I've got an exam today and tomorrow, but I'll try to get back to you ASAP.
When I was doing image processing in DirectShow our team gave up on using the Microsoft sample grabber like this and ended up writing code for our own filter to use callbacks. It was alot of extra work, but it depends how much data you need and what you want to do with it.
It gets easier!
Andrew
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I wanted to thank you for giving me some tips, I now have managed to solve the problem..
Basically i had 2 main issues.
1. I was not creating the bitmap header correctly.
2. I was passing the wrong image sizes to the bitmap.
Thank you for your suggestions and good luck with your exams. I would still be interested in looking at your code if you do find it as it might be more efficient then what i wrote!!
|
|
|
|
|
Hi, I am trying to catch keystrokes from a modal dialog box in ATL.
I have tried all the usual methods, including the catching the WM_KEYDOWN message with the Message Map, overidding the PreTranslateMessage function and overriding the DialogProc function. These methods all work for the modeless dialog boxes but not my modal one.
Any ideas?

|
|
|
|
|
Hi all,
1. I want to get MAC address of all the client machines in private network of my org. I don't want to use SNMP as the agent should be enabled in all my clients. How to do this??
2. I used WNet calls to enumarate the Client details, I could see only the Name of the machine, Microsoft or Novell, and Node or Container. How can I use the WNet API to get the MAC of all the clients in the private network of my organization ??
Thanks in advance,
Satya 
|
|
|
|
|
Not knowing diddly about WNet or having ever gotten a MAC address locally or even over the network here is my stupid suggestion
Doesn't ARP ask "who is ip address such and such?" and then the client with that IP responds with its MAC address. If so, if you have all of the IP addresses of each client on your private network, I would think an ARP "Who is" request work.
Just guessing but it sounds logical.
|
|
|
|
|
I'm not sure what is wrong with my activex control, "Microsoft Web Browser". I add the activex control to my dialog project with no problem. Then I add a member variable to my main dialog class for this activex control. In Visual Studio .net whenever you add a variable for the control, a wrapper class is automatically generated. I believe my problem lies in this automatically generated class. I'm not sure if it's my copy of visual studio .net (2002) but I believe the code being generated for this class is wrong. I have also tried this in VS 6.0 and everything worked fine, and the wrapper class looked completely different. What could be wrong. I haven't been programming in C++ for that long so little things sometimes throw me off, but this time I believe it's a problem with VS .net or my installation of it.
Please Help
This is the wrapper code generated:
<br />
#pragma once<br />
<br />
<br />
<br />
<br />
class CExplorer1 : public CWnd<br />
{<br />
protected:<br />
DECLARE_DYNCREATE(CExplorer1)<br />
public:<br />
CLSID const& GetClsid()<br />
{<br />
static CLSID const clsid<br />
= { 0x8856F961, 0x340A, 0x11D0, { 0xA9, 0x6B, 0x0, 0xC0, 0x4F, 0xD7, 0x5, 0xA2 } };<br />
return clsid;<br />
}<br />
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,<br />
const RECT& rect, CWnd* pParentWnd, UINT nID, <br />
CCreateContext* pContext = NULL)<br />
{ <br />
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); <br />
}<br />
<br />
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, <br />
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,<br />
BSTR bstrLicKey = NULL)<br />
{ <br />
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,<br />
pPersist, bStorage, bstrLicKey); <br />
}<br />
<br />
public:<br />
enum<br />
{<br />
CSC_UPDATECOMMANDS = -1,<br />
CSC_NAVIGATEFORWARD = 1,<br />
CSC_NAVIGATEBACK = 2<br />
}CommandStateChangeConstants;<br />
enum<br />
{<br />
OLECMDID_OPEN = 1,<br />
OLECMDID_NEW = 2,<br />
OLECMDID_SAVE = 3,<br />
OLECMDID_SAVEAS = 4,<br />
OLECMDID_SAVECOPYAS = 5,<br />
OLECMDID_PRINT = 6,<br />
OLECMDID_PRINTPREVIEW = 7,<br />
OLECMDID_PAGESETUP = 8,<br />
OLECMDID_SPELL = 9,<br />
OLECMDID_PROPERTIES = 10,<br />
OLECMDID_CUT = 11,<br />
OLECMDID_COPY = 12,<br />
OLECMDID_PASTE = 13,<br />
OLECMDID_PASTESPECIAL = 14,<br />
OLECMDID_UNDO = 15,<br />
OLECMDID_REDO = 16,<br />
OLECMDID_SELECTALL = 17,<br />
OLECMDID_CLEARSELECTION = 18,<br />
OLECMDID_ZOOM = 19,<br />
OLECMDID_GETZOOMRANGE = 20,<br />
OLECMDID_UPDATECOMMANDS = 21,<br />
OLECMDID_REFRESH = 22,<br />
OLECMDID_STOP = 23,<br />
OLECMDID_HIDETOOLBARS = 24,<br />
OLECMDID_SETPROGRESSMAX = 25,<br />
OLECMDID_SETPROGRESSPOS = 26,<br />
OLECMDID_SETPROGRESSTEXT = 27,<br />
OLECMDID_SETTITLE = 28,<br />
OLECMDID_SETDOWNLOADSTATE = 29,<br />
OLECMDID_STOPDOWNLOAD = 30,<br />
OLECMDID_ONTOOLBARACTIVATED = 31,<br />
OLECMDID_FIND = 32,<br />
OLECMDID_DELETE = 33,<br />
OLECMDID_HTTPEQUIV = 34,<br />
OLECMDID_HTTPEQUIV_DONE = 35,<br />
OLECMDID_ENABLE_INTERACTION = 36,<br />
OLECMDID_ONUNLOAD = 37,<br />
OLECMDID_PROPERTYBAG2 = 38,<br />
OLECMDID_PREREFRESH = 39,<br />
OLECMDID_SHOWSCRIPTERROR = 40,<br />
OLECMDID_SHOWMESSAGE = 41,<br />
OLECMDID_SHOWFIND = 42,<br />
OLECMDID_SHOWPAGESETUP = 43,<br />
OLECMDID_SHOWPRINT = 44,<br />
OLECMDID_CLOSE = 45,<br />
OLECMDID_ALLOWUILESSSAVEAS = 46,<br />
OLECMDID_DONTDOWNLOADCSS = 47,<br />
OLECMDID_UPDATEPAGESTATUS = 48,<br />
OLECMDID_PRINT2 = 49,<br />
OLECMDID_PRINTPREVIEW2 = 50,<br />
OLECMDID_SETPRINTTEMPLATE = 51,<br />
OLECMDID_GETPRINTTEMPLATE = 52<br />
}OLECMDID;<br />
enum<br />
{<br />
OLECMDF_SUPPORTED = 1,<br />
OLECMDF_ENABLED = 2,<br />
OLECMDF_LATCHED = 4,<br />
OLECMDF_NINCHED = 8,<br />
OLECMDF_INVISIBLE = 16,<br />
OLECMDF_DEFHIDEONCTXTMENU = 32<br />
}OLECMDF;<br />
enum<br />
{<br />
OLECMDEXECOPT_DODEFAULT = 0,<br />
OLECMDEXECOPT_PROMPTUSER = 1,<br />
OLECMDEXECOPT_DONTPROMPTUSER = 2,<br />
OLECMDEXECOPT_SHOWHELP = 3<br />
}OLECMDEXECOPT;<br />
enum<br />
{<br />
READYSTATE_UNINITIALIZED = 0,<br />
READYSTATE_LOADING = 1,<br />
READYSTATE_LOADED = 2,<br />
READYSTATE_INTERACTIVE = 3,<br />
READYSTATE_COMPLETE = 4<br />
}tagREADYSTATE;<br />
enum<br />
{<br />
secureLockIconUnsecure = 0,<br />
secureLockIconMixed = 1,<br />
secureLockIconSecureUnknownBits = 2,<br />
secureLockIconSecure40Bit = 3,<br />
secureLockIconSecure56Bit = 4,<br />
secureLockIconSecureFortezza = 5,<br />
secureLockIconSecure128Bit = 6<br />
}SecureLockIconConstants;<br />
enum<br />
{<br />
SWC_EXPLORER = 0,<br />
SWC_BROWSER = 1,<br />
SWC_3RDPARTY = 2,<br />
SWC_CALLBACK = 4<br />
}ShellWindowTypeConstants;<br />
enum<br />
{<br />
SWFO_NEEDDISPATCH = 1,<br />
SWFO_INCLUDEPENDING = 2,<br />
SWFO_COOKIEPASSED = 4<br />
}ShellWindowFindWindowOptions;<br />
<br />
<br />
public:<br />
<br />
<br />
<br />
};<br />
|
|
|
|
|
I have a problem in ED (see sig) where sometimes the status bar panes go blank, even though text has been set in them. This happens quite often, to a very few of my users and may depend on how the PC's are setup and what other software is installed/running.
I have seen it happen, and I've spent a lot of time going over all of the code and cannot see anything wrong. Nor can I find anyway to reproduce the problem. And Spy++ hasn't helped. I get the impression that some other process is getting the MS Status Bar Control to play up, but I have no way of proving that.
Has anyone seen or heard of any problems like this?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
I need to write a control in C++ that is accessible from visual basic, and maybe even internet explorer.
I think that activeX is the way to do it. ( I am not developing .NET)
Would it be best to do it in ATL or MFC, or both?
Thanks,
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
ATL is the best way to write it. That's what ATL is designed to do, especially if you need to use it in IE and require something lightweight that doesn't rely on a lot of external dlls.
The ATL wizards will generate a lot of the boilerplate code for you. Used in conjuction with WTL you should be able to create a control very quickly.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Hello,
I need to enumerate all childs in a dialog, and set them to empty (0, unchecked, "", etc.). To do that, I use the EnumChildWindows function, and in the callback, I try to create a temporary CWnd* object, based on the hWnd. And to perform the correct treatment for each control, I use the IsKindOf (RUNTIME_CLASS (...)).
All is ok, but the CDateTimeCtrl don't work, the linker says :
dateTimeCtrl_pbDlg.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CDateTimeCtrl::classCDateTimeCtrl" (?classCDateTimeCtrl@CDateTimeCtrl@@2UCRuntimeClass@@B)
That's strange, because the CDateTimeCtrl contains DECLARE/IMPLEMENT_DYNAMIC so I don't understand the pb ...;
How can I do that ?
Any ideas ?
Thanks in advance
Thierry
|
|
|
|
|
I don't think it is such a good idea using MFC RUNTIME_CLASS for this. I use a combination of GetWindowLong( hWnd, GWL_STYLE ) and GetClassName( .. ) to work out what type a control is. This is straight Windows API stuff and doesn't rely on MFC. It is also more efficent than creating temporary CWnd objects etc.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I agree with you, that was my primary way, but the GetClassName seems more efficient. So I'll use it.
Thank you for your answer.
Thierry
|
|
|
|
|
will like to know if there are other ways to position my newly created dialog boxes (ie to have them open at the bottom right hand corner of window for instance). Is there another way other than using SetWindowPos?
thanks
|
|
|
|
|
One solution is the save the window's position in the registry upon exit. Another solution is MoveWindow().
Kuphryn
|
|
|
|
|
Hi,
If you would like to show your dialog box in center of the window use CenterWindow() in OnInitDialog function of your dialog based class.
|
|
|
|
|
CADORecordset m_rs;
//m_rs is opened
m_rs.AddNew();
How to cancel the AddNew();
|
|
|
|
|
If you are not in batch mode then you can't cancel it (undo your operation). You have to delete it.
m_rs.MoveLast();
m_rs.Delete( adAffectCurrent );
In batch mode you can just use CancelUpdate, or RollbackTransmission(). Now, I am not quite sure about the names of these last two functions, because I haven't used them extensively, but look at the ado recordset functions to figure out their actual names and syntaxes are.
By the way, why do you want to cancel AddNew()? Is it because of an error? Because if you have an error, then you can simply call m_rs.CancelUpdate().
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
CADORecordset m_rs;
//m_rs is opened
m_rs.AddNew();
How to cancel to the AddNew();
|
|
|
|
|
|
Handle the WM_KEYDOWN message in one of your windows.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|