|
I've looked all around CP and MSDN for a way to place a control (e.g. a button) within an edit control's non-client area, but haven't had any luck.
All of the implementations I have seen haven't really placed controls there, but have just mimicked the control by resizing and painting the NC area. Like this:
http://www.codeproject.com/editctrl/fileeditctrl.asp[^]
I tried just placing the control in the client area, but it gets painted over as soon as the user clicks in the edit box, which is ugly.
Can someone point me in the right direction?
Thanks.
|
|
|
|
|
Since an edit control has no non-client area the article you found is probubly the best place to start.
Trust in the code Luke. Yea right!
|
|
|
|
|
I want to get some info about hardware.
such as: name of device....
1. Operating System: Microsoft Windows 2000 Professional (5.0, Build 2195)
2. Mainboard: Chipset Via tech
3. CPU Processor: Intel Pentium III 933Mhz
4. Ram: 256MB RAM
5. Harddisk:ST340016A
6. Netword card: REPOTEC RP-1624W 100Base-TX PCI Fast Ethernet Adapter
7. Display VGA card: NVidia Riva TNT
8. Sound card: Avance AC97 Audio
9. CD Rom:
10. Keyboard:
11. Mouse: ...
Cound you help me to get this info of hardware
thank you!
|
|
|
|
|
That's a tall order as the information is scattered amongst several APIs. Try:
GetSystemInfo()<br />
GetVersionEx()<br />
DirectSoundEnumerate()<br />
GlobalMemoryStatusEx()
Other posters can surely complement this list to get a full manifest of the hardware information.
|
|
|
|
|
I have a file deleter program that deletes cookies and temporary internet files, however, it sends the files to the recycle bin.
Is it possible to secure delete the files, this means that the files are not moved to the "recycle bin", but rather are actually fully deleted from the hard drive.
|
|
|
|
|
What method are you currently using to delete with?
|
|
|
|
|
I use the following class to delete files.
void CFileDeleter::Initialize()
{
m_nDeleteType = 0;
LoadDeleteType();
}
void CFileDeleter::LoadDeleteType()
{
HKEY hKey;
long lRet;
int nType = 0;
DWORD dw = sizeof(int);
DWORD dwType = REG_DWORD;
lRet = RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\iISoftware\\iIWiper",0,KEY_ALL_ACCESS,&hKey);
if(lRet == ERROR_SUCCESS)
{
lRet = RegQueryValueEx(hKey,"DeleteType",0,&dwType,(LPBYTE)&nType,&dw);
if(lRet == ERROR_SUCCESS)
{
m_nDeleteType = nType;
}
}
}
BOOL CFileDeleter::FileDeleteOperation(LPTSTR lpszFile)
{
DWORD dwAttrib;
dwAttrib = GetFileAttributes(lpszFile);
if (dwAttrib == 0xFFFFFFFF)
{
return FALSE;
}
switch(m_nDeleteType)
{
case DELETE_RECYCLE:
{
SHFILEOPSTRUCT f;
ZeroMemory(&f, sizeof(SHFILEOPSTRUCT));
f.wFunc = FO_DELETE;
f.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION;
lpszFile[lstrlen(lpszFile)+1] = 0;
f.pFrom = lpszFile;
SHFileOperation(&f);
break;
}
case DELETE_DELETE:
DeleteFile(lpszFile);
break;
default:
{
SHFILEOPSTRUCT f;
ZeroMemory(&f, sizeof(SHFILEOPSTRUCT));
f.wFunc = FO_DELETE;
f.fFlags = FOF_ALLOWUNDO;
f.pFrom = lpszFile;
SHFileOperation(&f);
break;
}
}
return TRUE;
}
|
|
|
|
|
Just omit the FOF_ALLOWUNDO flag.
|
|
|
|
|
Thank's,
I deleted the FOF_ALLOWUNDO flag.
Now I don't see the deleted files in the recycle bin anymore, but when I click on the Clean File in my program, before it deletes, for every cookie a dialog box pops: Are you sure you want to delete "cookie name"?
Is there any way I could stop that message from popping up?
|
|
|
|
|
azi_games wrote:
Is there any way I could stop that message from popping up?
Adding FOF_NOCONFIRMATION, I presume.
|
|
|
|
|
|
I'm wondering if there is an API fn to effectively perform the same as adding an entry to the HOSTS file. I seem to be drawing a blank so far with my google and msdn search attempts.
Cheers,
Phil
|
|
|
|
|
It's just a text file. Would the normal file I/O functions not suffice?
CStdioFile file;<br />
file.Open("hosts", CFile::modeWrite);<br />
file.SeekToEnd();<br />
file.WriteString("127.0.0.1 www.aadserver.net\n");<br />
file.Close();
|
|
|
|
|
Hello
I'm currently trying to port a library to CE.NET using eVC 4.0. The problem is we are using a 3rd party library that uses iostreams. There is a verion of STL that comes with eVC 4.0 but it doesn't support iostreams. I tried using STLport without much luck.
Has anybody had similar problems? What had to be done to get it to work?
Thanks!
|
|
|
|
|
Does anyone know of any way to find out info about drivers through some sort of API? In particular I am interested in the sound card driver. To be clear, I am not looking for the capabilities of the sound card, like supported bitrates, and things like that, more like, is it a VxD, WDM, etc..
Any ideas?
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
Ok... Can anybody tell me what I am doing wrong here please ?
struct MyStruct1 {
int m_integer;
}
struct MyStruct2 {
MyStruct1 *pStruct1;
}
MyStruct2 m_struct2;
MyObject::MyObject() {
m_struct2.pStruct1 = NULL;
m_struct2.pStruct1 = (MyStruct1 *) malloc(10);
}
MyObject::~MyObject() {
if(m_struct2.pStruct1)
{
free(struct2.pStruct1); <- I get error here....
}
}
|
|
|
|
|
You failed to mention if the error was compilation or run-time. Given just the code you provided, it has several compile errors. Those can be fixed with:
struct MyStruct1
{
int m_integer;
};
struct MyStruct2
{
MyStruct1 *pStruct1;
};
MyStruct2 m_struct2;
class MyObject
{
public:
MyObject();
~MyObject();
};
MyObject::MyObject()
{
m_struct2.pStruct1 = NULL; <code>
m_struct2.pStruct1 = (MyStruct1 *) malloc(10);
}
MyObject::~MyObject()
{
if(m_struct2.pStruct1)
{
free(m_struct2.pStruct1);
}
}
|
|
|
|
|
Ok.. You are right.. I didn't have enough info.. Here is what I use and I am getting run time error..'Debug error.. DAMAGE: after normal block(#42) at 0x002FO7EO.' and it is failing at free(m_Struct2.pStruct1); What do you think that I am doing wrong??
#include <stdio.h>
#include <memory.h>
#include <malloc.h>
struct MyStruct1 {
int m_interger;
int m_interger2;
int m_interger3;
int m_interger4;
};
struct MyStruct2 {
MyStruct1 *pStruct1;
};
class MyObject {
public:
MyObject();
~MyObject();
MyStruct2 m_Struct2;
};
MyObject::MyObject()
{
m_Struct2.pStruct1 = (MyStruct1 *) malloc(10);
m_Struct2.pStruct1->m_interger = 5;
m_Struct2.pStruct1->m_interger2 = 5;
m_Struct2.pStruct1->m_interger3 = 5;
m_Struct2.pStruct1->m_interger4 = 5;
}
MyObject::~MyObject()
{
if(m_Struct2.pStruct1)
free(m_Struct2.pStruct1);
m_Struct2.pStruct1 = NULL;
}
main() {
MyObject *myObject;
myObject = new MyObject;
delete(myObject);
return 0;
}
|
|
|
|
|
Actually, I think as I type it out onto the editor, I saw one problem with my logic.
m_Struct2.pStruct1 = (MyStruct1 *) malloc(10); <- Bad isn't it?
That ought to be
m_Struct2.pStruct1 = (MyStruct1 *) malloc(sizeof(MyStruct1) * 10);
Otherwise m_Struct2 is not getting created enough space for it's field..
Silly me.. Thanks for the heads up.
|
|
|
|
|
It looks like you need to use new instead of malloc() so that MyStruct1's constructor gets called. Maybe that's just for MFC, however, and not C++ in general.
|
|
|
|
|
new is c++ all the way, no MFC required
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
In the "Hello World!" sample, I put some code of mine, it looks like following:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
...<br />
<br />
static HWND hwndButton,hwndEdit,hwndList;<br />
switch (message) <br />
{<br />
case WM_CREATE:<br />
hwndButton=CreateWindow("BUTTON","Hell&o",WS_CHILD|WS_VISIBLE|WS_BORDER,10,10,100,20,hWnd,(HMENU)1001,hInst,NULL);<br />
hwndEdit=CreateWindow("EDIT",NULL,WS_CHILD|WS_VISIBLE|WS_BORDER,10,50,100,20,hWnd,(HMENU)1002,hInst,NULL);<br />
hwndList=CreateWindow("LISTBOX",NULL,WS_CHILD|WS_VISIBLE|WS_BORDER,10,90,100,100,hWnd,(HMENU)1003,hInst,NULL);<br />
break;<br />
case WM_COMMAND:<br />
if(LOWORD(wParam)==1001)<br />
MessageBox(hWnd,"hello",NULL,MB_OK);<br />
break;<br />
...<br />
}
When I clicked (use mouse) in Button, it shows a "hello" messagebox and in its caption, 'o' char is underlined
but when I am typing in Edit(Edit got focus) or ListBox got focus, I use keyboard to press Alt-O, I dont see "hello" messagebox
And when I pressed TAB key, focus dont move between my controls
Could you show me the way to help me
thank you so much!
|
|
|
|
|
Try adding WS_TABSTOP to the style for each control when you create it:
hwndButton=CreateWindow("BUTTON","Hell&o",WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,10,10,100,20,hWnd,(HMENU)1001,hInst,NULL);
hwndEdit=CreateWindow("EDIT",NULL,WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,10,50,100,20,hWnd,(HMENU)1002,hInst,NULL);
hwndList=CreateWindow("LISTBOX",NULL,WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP,10,90,100,100,hWnd,(HMENU)1003,hInst,NULL);
Good luck with it,
Chris Richardson Terrain Software
|
|
|
|
|
thank but sorry
I still dont see that msgbox when press Alt-O
|
|
|
|
|
Strange. Maybe it's something messed up in the message loop. Can you post all the code?
Chris Richardson Terrain Software
|
|
|
|
|