|
Why do you want to delete kernel32? It's a core OS component! Windows won't run without it!! You can't delete it probably because it's loaded into memory and is being used ... for the delete operation!
But if you insist... maybe you can try starting your machine in DOS mode (maybe with a DOS bootable floppy). That way windows won't have loaded it and you can then delete it (after disabling the readonly mode).
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Make a startup disk. Boot your machine using it. Now once you have booted in DOS mode you can go to the windows directory and delete kernel32.dll
del kernel32.dll
Somewhere in the world there is a machine language programmer waiting for that damned assembly language fad to pass. - Stan Shanon
|
|
|
|
|
I'm sure the answer to this will be obvious (about 5 seconds after I read the response) but I'm mightily puzzled by this...
I've derived a class from CFileDialog that looks like this...
class CLoadLogFilesDlg : public CFileDialog
{
DECLARE_DYNAMIC(CLoadLogFilesDlg)
public:
CLoadLogFilesDlg(BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL);
~CLoadLogFilesDlg();
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
private:
CStringList m_slFileList;
protected:
virtual BOOL OnFileNameOK();
virtual void OnOK();
afx_msg void OnLoadAll();
afx_msg void OnLoadToday();
DECLARE_MESSAGE_MAP()
};
and the class implementation is this...
IMPLEMENT_DYNAMIC(CLoadLogFilesDlg, CFileDialog)
CLoadLogFilesDlg::CLoadLogFilesDlg(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName, DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) : CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
CString csInitDir;
TCHAR szWinDir[_MAX_PATH + 1];
m_ofn.lStructSize = sizeof(OPENFILENAME);
m_ofn.Flags |= OFN_ENABLETEMPLATE | OFN_ALLOWMULTISELECT;
m_ofn.hInstance = AfxGetInstanceHandle();
m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_LOADLOGS);
GetWindowsDirectory(szWinDir, _MAX_PATH);
csInitDir.Format(_T("%s\\%s"), szWinDir, COMMANDPIPENAME);
m_ofn.lpstrInitialDir = csInitDir;
m_ofn.lpstrFile = new TCHAR[10000];
m_ofn.nMaxFile = sizeof(m_ofn.lpstrFile);
memset(m_ofn.lpstrFile, 0, sizeof(m_ofn.lpstrFile));
}
CLoadLogFilesDlg::~CLoadLogFilesDlg()
{
delete m_ofn.lpstrFile;
}
void CLoadLogFilesDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BOOL CLoadLogFilesDlg::OnFileNameOK()
{
return FALSE;
}
BOOL CLoadLogFilesDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
OFNOTIFY* pNotify = (OFNOTIFY*) lParam;
TRACE("pNotify->hdr.code == %x\n", 0 - pNotify->hdr.code);
if (pNotify->hdr.code == CDN_FILEOK)
return OnFileNameOK();
return CFileDialog::OnNotify(wParam, lParam, pResult);
}
BEGIN_MESSAGE_MAP(CLoadLogFilesDlg, CFileDialog)
ON_COMMAND(IDC_LOADALL, OnLoadAll)
ON_COMMAND(IDC_LOADTODAY, OnLoadToday)
END_MESSAGE_MAP()
void CLoadLogFilesDlg::OnLoadAll()
{
}
void CLoadLogFilesDlg::OnLoadToday()
{
CString csPattern;
csPattern.Format(_T("%s\\*.log"), m_ofn.lpstrInitialDir);
CFileFind ff;
BOOL bWorking = ff.FindFile(csPattern);
while (bWorking)
{
bWorking = ff.FindNextFile();
m_slFileList.AddHead(ff.GetFilePath());
}
CFileDialog::OnOK();
}
void CLoadLogFilesDlg::OnOK()
{
CFileDialog::OnOK();
}
The problem is that I never ever see a call to CLoadLogFilesDlg::OnFileNameOK() even though it's an override of a virtual function. When I see calls to the overridden OnNotify function the trace output is
pNotify->hdr.code == 25b
pNotify->hdr.code == 25a
pNotify->hdr.code == 25a
now when we look at the CFileDialog::OnNotify() function we find this code...
BOOL CFileDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
ASSERT(pResult != NULL);
if (CCommonDialog::OnNotify(wParam, lParam, pResult))
return TRUE;
OFNOTIFY* pNotify = (OFNOTIFY*)lParam;
switch(pNotify->hdr.code)
{
case CDN_INITDONE:
OnInitDone();
return TRUE;
case CDN_SELCHANGE:
OnFileNameChange();
return TRUE;
case CDN_FOLDERCHANGE:
OnFolderChange();
return TRUE;
case CDN_SHAREVIOLATION:
*pResult = OnShareViolation(pNotify->pszFile);
return TRUE;
case CDN_HELP:
if (!SendMessage(WM_COMMAND, ID_HELP))
SendMessage(WM_COMMANDHELP, 0, 0);
return TRUE;
case CDN_FILEOK:
*pResult = OnFileNameOK();
return TRUE;
case CDN_TYPECHANGE:
OnTypeChange();
return TRUE;
}
return FALSE; }
and if we look at the definitions of the case labels we find they're
#define CDN_LAST (0U-699U)
#define CDN_INITDONE (CDN_FIRST - 0x0000)
#define CDN_SELCHANGE (CDN_FIRST - 0x0001)
#define CDN_FOLDERCHANGE (CDN_FIRST - 0x0002)
#define CDN_SHAREVIOLATION (CDN_FIRST - 0x0003)
#define CDN_HELP (CDN_FIRST - 0x0004)
#define CDN_FILEOK (CDN_FIRST - 0x0005)
#define CDN_TYPECHANGE (CDN_FIRST - 0x0006)
#define CDN_INCLUDEITEM (CDN_FIRST - 0x0007)
it's pretty obvious that the notification codes my dialog procedure is seeing don't match any of those constants which is why I'm not seeing calls to my overrides. I have no idea why? Any ideas?
Rob Manderson
http://www.mindprobes.net
"I killed him dead cuz he was stepping on my turf, cutting me out of my bling the same way my ho cuts cookies, officer"
"Alright then, move along" - Ian Darling, The Lounge, Oct 10 2003
|
|
|
|
|
Looks ok to me. I've compared your code with code I've written for ED and it is much the same. Why are you overiding OnNotify() though. Your OnFileNameOK() will be called by the framework without you doing this. I have a note in my code: "Note that OnFileNameOK() isn't called if the edit control is empty". Don't know if this is relevant.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thanks Neville. I didn't know that OnFileNameOK() isn't called if the edit control is empty - add that one to the background pile
I'm overriding OnNotify() just so's I can see the notification codes pass by. I've fixed the couple of things Igor pointed out - the second one was setting the m_ofn.nMaxFile member to 4 instead of the buffer size. Once I did that I've started seeing OnFileNameOK() being called if I select a file and hit ok. The dialog still isn't working the way I'd like but I imagine some spelunking in MFC internals (always good for the soul ) will reveal why.
Rob Manderson
http://www.mindprobes.net
"I killed him dead cuz he was stepping on my turf, cutting me out of my bling the same way my ho cuts cookies, officer"
"Alright then, move along" - Ian Darling, The Lounge, Oct 10 2003
|
|
|
|
|
I maybe wrong here, and it's not really a problem, but please check yours CLoadLogFilesDlg constructor:
That sequence:
CLoadLogFilesDlg::CLoadLogFilesDlg(...<br />
...<br />
CString csInitDir;<br />
...<br />
m_ofn.lpstrInitialDir = csInitDir; <br />
... <br />
}
After constructor exits m_ofn.lpstrInitialDir will point to somewhere in the heap that just got released on destruction of csInitDir.
Just 2 cents...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
You're right of course, but that's not the problem
Rob Manderson
http://www.mindprobes.net
"I killed him dead cuz he was stepping on my turf, cutting me out of my bling the same way my ho cuts cookies, officer"
"Alright then, move along" - Ian Darling, The Lounge, Oct 10 2003
|
|
|
|
|
OK, then check this in constructor:
m_ofn.lpstrFile = new TCHAR[10000]; <br />
m_ofn.nMaxFile = sizeof(m_ofn.lpstrFile);<br />
memset(m_ofn.lpstrFile, 0, sizeof(m_ofn.lpstrFile));
m_ofn.nMaxFile will be initialized to just 4: is it what you want?
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Thanks for pointing that out Amazingly obvious once you mentioned it
Rob Manderson
http://www.mindprobes.net
"I killed him dead cuz he was stepping on my turf, cutting me out of my bling the same way my ho cuts cookies, officer"
"Alright then, move along" - Ian Darling, The Lounge, Oct 10 2003
|
|
|
|
|
hi
i have a Server program which is listening at a port 1111. when a client connects at this port the onaccept virtual method is executed and i use getPeername to get the ip and port address. what i see in the port adrress is some other value say 1412 which is greater than the port i have specified to listen.
why is it showing like this doesnt it mean port 1412 is also opened.
your explanation will be valuable for me
Regards
Aswin.N.Paranji
|
|
|
|
|
That's the port number of the client end of the connection, not the server end.
The client end cannot listen for new connections, it can only receive data sent from your server socket, until the connection is closed.
I suggest you read the Winsock Programmer's FAQ[^].
|
|
|
|
|
Hi all,
Is there any way to get the exposed cell values of grid like DBGrid, MSFlexiGrid which is in some running applications and also to get the exposed method names?
Regards,
Naveen S G
|
|
|
|
|
Hi all,
i would like to know how to get the control names (like editbox name or combobox name) from running VB/Delphi application.
i need this to identify and work on those controls.
it is required for me to automate the testing process of that application.
Naveen S G
|
|
|
|
|
|
Hi Michael,
i want to extract the name of controls like editbox or grid control which exists in some running application.
u might be knowing there will be name associated with every control in Visual Basic. Using name only(instead of window handle) we work those controls in VB.
i would like to know how can i get that name from my vc++ program.
Thanks in advance,
Naveen S G
|
|
|
|
|
You're either wanting to know the id of the control (GetDlgCtrlID() ) or the window class name (GetClassName() ).
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi David,
i m not wanting to know the id of control. i want to extract the name of control. for e.g.: in vb name of editbox is Name. if u want to display its text u can do it using Msgbox Name.Text . this name, i want to extract. because identifying controls of another running application is easier with name than with objectIndex and Class name.
Thanks in advance,
Naveen S G
|
|
|
|
|
naveensg wrote:
i want to extract the name of control.
This is a VB thing. Controls in VC do not have names, they have ids instead. Your MsgBox Name.text statement would equate to the following in VC:
GetDlgItemText(...); or GetWindowText(...);
MessageBox(...);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i accept that controls in VC do not have names. but i want to extract the control name of running VB Application from my VC Program.
|
|
|
|
|
Any standard ActiveX Container (i hope VB is) should support for DISPLAYNAME ambient property that from inside of the control could be accessed through
GetAmbientProperty(DISPID_AMBIENT_DISPLAYNAME, var);
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
do u have any sample code related to that. if u have plz mail me.
i have read in some article that by getting container of the form and by doing queryinterface, v can get the name of controls.
|
|
|
|
|
It's straightfoward:
If you are using MFC and your control is COleControl derived somewhere inside of your controls code just use the following:
...
CString strControlName;<br />
GetAmbientProperty(DISPID_AMBIENT_DISPLAYNAME, VT_BSTR, &strControlName); ...
After that strControlName will be filled with the name assigned to your control by the container.
For implementation detailes see GetAmbientProperty implementation in MFC.
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
just take for example there are no activex/ole controls in VB form. it contains only standard controls like editbox, combobox.
just by getting window handle, is it possible to get the clientsite/IDisapatch/IUnknown. because if i get the clientsite, it is possible to get the control names.
Given a pointer to IOleClientSite, it is possible to enumerate through all of the other controls on a form by making use of the following interfaces:
IOleClientSite,IOleContainer,IEnumUnknown,IUnknown,IOleObject,IOleClientSite,
IOleControlSite.
but my question is:
i have only window caption and its class. by using those information is it possible to get the clientsite of the VB Form.
Thanks in advance,
Naveen S G
|
|
|
|
|
Common answer is NO.
However, you may try to look into the following possibilities:
1. If your VB App is automation server -- maybe there is method that returns you what you need -- is it registering itself in Running Objectc Table or maybe it's singleton -- you can get IDispatch of it;
2. Maybe VB Form is dynamic container and allow new control insertion -- so you may write your new control that has functionality you need;
3. If form has at least one ActiveX Control -- you can look into it's CLSID and write your control that will register under the same CLSID as original one and will be just an aggregator for original control -- so VB Form will create your control and your control will be delegating all OLE calls to original control;
4. Overload CoCreateInstance -- using different techniques of injecting your code -- try overloading CoCreateInstance/CoGetClassObject -- it is possible that control name could be extracted through VB Extender control -- passed to CoCreateInstance as pOuterUnknown;
5. If your VB App is Active Accessibility Compliant: Check AccessibleObjectFromWindow available in OLEACC.dll as well as read that article and search MSDN:
http://msdn.microsoft.com/msdnmag/issues/0400/aaccess/default.aspx
In any case it's R&D and may require alot of efforts to implement or fail -- unless VB code is accessible for modifications...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
i would like to know how to get the handle of context menu of some other running MFC application or how to work on context menu of some other MFC application. i want to check whether some particular menu item is enabled or not.
if anybody knows, plz mail me.
Naveen
|
|
|
|