|
Help. I want to change the appearence of a check box control so that it looks flat, no background, no border, only the check appears.
The control will serve as a visual indicator and not accept input from user.
How can I do this or where should I look?
Thanks,
John
|
|
|
|
|
No background? You mean that there will be some other controls below and you want to see them?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I want the Check Box to have the same "grey" background as the Dialog which contains it -- i.e. no white background, no border around the check box.
I hope this won't be impossible or have to resort to display a bitmap.
Thanks.
Johnny
|
|
|
|
|
Derive your class from CWnd and call DrawFrameControl in OnPaint handler. DrawFrameControl can draw many UI elements, some combination of flags should give you just checkmark on standard background. No bitmap required.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
Just use a picture control with an icon - that way the background will be see-through. Then use ShowWindow(SW_SHOW / SW_HIDE) to show or hide the control.
--
Andrew.
|
|
|
|
|
Thanks.
I guess I was intimidated by using a graphic.
John
|
|
|
|
|
I have a DB in Access 2000 for which I'm trying to access from a VC++ executable using DAO. When I try to query the DB I get a dialog asking me to select a data source. If I convert the database back to a prior version which I believe is 97 format, it works fine. Might anyone know why I get the data source dialog and how I might be able to get these queries to work with a 2000 version of the DB?
Also, is it possible to convert a 2000 DB to 95? I see that Access says it can convert back to a prior but I'm wondering if this prior version is 97 and not 95.
Thanks!
"Save a tree, use Email!"
|
|
|
|
|
Check KB article Q236991.
Basically, if you're linked to MFC DLL, this should be enough to enable DAO 3.6:
AfxGetModuleState()->m_dwVersion = 0x0601;
AfxDaoInit();
There's C++ Q&A column in Jan'2000 issue of MSJ that also describes this.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all,
Is there a way to detect if the program I'm about to launch already running?
In other words, I don't want to have more than one of the same application running. So far, I've tried EnumProcesses() and other
good stuffs but have no luck. I have a function called ProcessExist(),shown below, to detect if the specified app is currently running.
This function works if I call it from another application.
The problem is that if I call ProcessExist() inside my application, that application is ALREADY running, so ProcessExist() doesn't solve the problem.
Any help is appreciated.
Thanks
//////////////////////////////////////////////////////////
CString CMyProcess::GetProcessName(DWORD pid)
{
char ProcName[MAX_PATH]=_T("unknown");
CString Name;
HANDLE handle=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,pid);
if (handle)
{
HMODULE hMod;
DWORD needed;
if (EnumProcessModules(handle,&hMod,sizeof(hMod),&needed))
{
GetModuleBaseName(handle,hMod,ProcName,sizeof(ProcName));
Name = ProcName;
}
CloseHandle(handle);
}
return Name;
}
BOOL CMyProcess::ProcessExist(LPCTSTR lpProcName, CString &fullpathname, DWORD &pid)
{
DWORD pids[1024];
DWORD bytes_needed=0;
DWORD num_procs=0;
BOOL result = FALSE;
CString str;
if (EnumProcesses(pids,sizeof(pids),&bytes_needed))
{
num_procs = bytes_needed / sizeof(DWORD);
for (DWORD i=0; i
|
|
|
|
|
A small thing which you can do is as follows.At the beginning of the
program call a small function say init() which creates a mutex ,if that
mutex already exists that means you have another instance running.
BOOL init()
{
HANDLE mutex = CreateMutex(NULL, FALSE, "mutexname");
if(mutex == NULL)
return FALSE;
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
MessageBox("Another instance is already running.");
return FALSE;
}
return TRUE;
}
|
|
|
|
|
Thanks Rachna. I'll try that.
|
|
|
|
|
Hello
You can use this class [from MSDN]
#ifndef LimitSingleInstance_H
#define LimitSingleInstance_H
#include <windows.h>
class CLimitSingleInstance
{
protected:
DWORD m_dwLastError;
HANDLE m_hMutex;
public:
CLimitSingleInstance(TCHAR *strMutexName)
{
m_hMutex = CreateMutex(NULL, FALSE, strMutexName);
m_dwLastError = GetLastError();
}
~CLimitSingleInstance()
{
if (m_hMutex)
{
CloseHandle(m_hMutex);
m_hMutex = NULL;
}
}
BOOL IsAnotherInstanceRunning()
{
return (ERROR_ALREADY_EXISTS == m_dwLastError);
}
};
#endif
hope this helps
Nish
|
|
|
|
|
How to create a string with the identifier "IDS_STR1"?
I use the following statement to declare IDS_STR1.
#define IDS_STR1 1;
Thanks.
Maer
|
|
|
|
|
Are you talking about the string table in resources?
You can use a string table resource with CString via the LoadString method.
CString sTemp = _T("");
sTemp.LoadString(IDS_STR1)
Michael
|
|
|
|
|
|
CString strWhatever(MAKEINTRESOURCE(IDS_STR1));
or
CString strWhatever;
strWhatever.LoadString(IDS_STR1);
|
|
|
|
|
Hello, the codegurus around the world.;)
We can create the string with IDS_STR1 in the string table of the resource section
in Visual studio.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
|
Any idea to compile some HTML files into one file. especially the pictures.;)
|
|
|
|
|
Open the file with IE5+ and save it as a .mht (something like a multipart email message).
As far as I know you can only open such a file with IE5+, however.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hello:
In order to display a bmp Image in a dialog box I created a class named "CImageBox" which was derived from CWnd just like "CStatic". "CImageBox" was created with the style "...|WS_HSCROLL|WS_VSCROLL".
Here comes the problem: How to handle the horizontal and vertical scrollbar?
These are my three unsuccessful experiences:
<1>CWnd::GetScrollBarCtrl() always return NULL;
<2>CView::GetScrollBarCtrl() do not seem to be applicative;
<3>I try to handle WM_VSCROLL in "CImageBox":
void CImageBox::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) ;
The parameter "pScrollBar" is always NULL so I can't use the SetScrollPos() member function.
However "CEdit"(MFC) do well in this,but I can't find the source code of CEdit::GetScrollBarCtrl().
Can anybody help me?
Any advice is appreciable.<shawell2000@163.net>
|
|
|
|
|
You don't need scrollbar controls - any window can display scrollbars which are integral parts of it, just like border or caption.
Use Cwnd methods like Get/SetScrollRange, Get/SetScrollPos, handle WM_VSCROLL/WM_HSCROLL and you'll be OK.
Note that scrollbars will not appear until you set range greater than client area size.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
I'm facing a problem with VC++ ver 6.0(MFC), when ever I try to compile rc file it fails giving fatal error RC1015: Cannot open include file 'afxres.h'. Even if I try to create standard simple dialog based application, while compiling the rc file it fails showing above error,I mean to say VC is failing to build all the applications(VC ver 6.0). I checked the environment variables, thinking there might be problem with environment variables setting, ran vcvars32.bat from "program files\Microsoft visual studio\vc98\bin". Even then it gives the same problem saying, "can not open afxres.h".
If any one knows about this problem, please let me know the solution.
Thanks in advance,
Lakshmi.
|
|
|
|
|
A couple of obvious things to check:
- Is
afxres.h still there? Have a look in C:\Program Files\Microsoft Visual Studio\VC98\mfc\include (or your equivalent) and make sure - Your include paths may not be set up correctly. Check to ensure this directory is on the include path inside the IDE
If all else fails, just re-install VC and the problem should go away.
Andy Metcalfe - Sonardyne International Ltd (andy.metcalfe@lineone.net) http://www.resorg.co.uk
"I'm just another 'S' bend in the internet. A ton of stuff goes through my system, and some of the hairer, stickier and lumpier stuff sticks."
- Chris Maunder (I just couldn't let that one past )
|
|
|
|
|
Hi,
I am trying to generate reports in my VC application using Crystal Reports 7. I have created the .rpt file. Now I need to integrate this file with the VC application. How can I do so?
My object is that report should not be directly printed but first It should be displayed (with all print preview options) and when the user selects print option it then prints to default printer.
Please help.....
Thanks for ur time .....
~Statbat( );
|
|
|
|