|
can u please tell me how to manipulate with one window in a dialogbox that looks like a grid of editboxes containing many rows,columns ( sth like the local variables window which appear in vc++ while doing step debugging).what kind of a control is it? for an edit box u sing the GetWindowText we can get its contents. pleas help me how to get the many values present in that grid object(window).
|
|
|
|
|
You can use a CListCtrl. Apply the "ReportView" and "NoColumnHeader" Styles and Gridlines as ExStyle.
MS
|
|
|
|
|
tejaswi_teja wrote:
can u please tell me how to manipulate with one window in a dialogbox that looks like a grid of editboxes containing many rows,columns
Take a look at this, should give you the functionality you desire.
MFC Grid control 2.25[^]
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I developed one scheduler application.
When I run this applcation (scheduler.exe)it is running.
Next If I start another (scheduler.exe) is running.
How to stop another process .,when One process is in running.
Plz give reply urgently.
Praveen Chowdam Kumar
|
|
|
|
|
Yesterday I solved this problem. Try the following link.
http://www.codeproject.com/cpp/avoidmultinstance.asp
OR
Try following solution.
Insert the following code in YourApp::InitInstance().
bool AlreadyRunning;
HANDLE hMutexOneInstance = ::CreateMutex( NULL, TRUE,
UNIQUE_GUID);
AlreadyRunning = (GetLastError() == ERROR_ALREADY_EXISTS);
if (hMutexOneInstance != NULL)
{
::ReleaseMutex(hMutexOneInstance);
}
if ( AlreadyRunning )
{ /* kill this */
AfxMessageBox("Application instance already running");
HWND hOther = g_hWnd;
if (hOther != NULL)
{ /* pop up */
::SetForegroundWindow(hOther);
if (IsIconic(hOther))
{ /* restore */
::ShowWindow(hOther, SW_RESTORE);
} /* restore */
} /* pop up */
return FALSE; // terminates the creation
} /* kill this */
// ... continue with InitInstance
UNIQUE_GUID is defined as
#define UNIQUE_GUID _T("YourAppName{1C7496E6-5949-4907-9F3E-CE26ED9EEB78}")
I generated this string using GUIDGEN.EXE (Visual Studio tool). String here is new string you can use it.
|
|
|
|
|
This is FAR TOO OFTEN overlooked aspect of naming synchronization objects.
If this is run from a terminal services console or as a service, that is the only instance that can work on the entire system - the mutext will be seen across all sessions. If this is started first from a terminal services session, then other sessions could also start, since the mutex will have local scope.
If you REALLY REALLY only want one instance on the enire computer, then you need to put "Global\" in front of your mutex name. If you really want each terminal services session to only run a single instance, then put "Local\" in front of your mutex name.
Services and the console terminal services session share the same scope.
So, if you want the console session to be able to run at the same time as it runs as a service, then you need a different name when it runs as as service.
From MSDN:
Terminal Services: The name can have a "Global\" or "Local\" prefix to explicitly create the object in the global or session name space. The remainder of the name can contain any character except the backslash character (\). For more information, see Kernel Object Namespaces.
Windows XP Home Edition: Fast user switching is implemented using Terminal Services sessions. The first user to log on uses session 0, the next user to log on uses session 1, and so on. Kernel object names must follow the guidelines outlined for Terminal Services so that applications can support multiple users.
Windows 2000: If Terminal Services is not running, the "Global\" and "Local\" prefixes are ignored. The remainder of the name can contain any character except the backslash character.
Windows NT: The name can contain any character except the backslash character.
Windows Me/98/95: The name can contain any character except the backslash character. The empty string ("") is a valid object name.
|
|
|
|
|
parims wrote:
How to stop another process .,when One process is in running.
In Conitnuation With Poster Above my post.... you can depend upon this wrapper class too...
http://www.codeproject.com/cpp/csingleinst.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi
You Can create mutex in Scheduler.exe in CWinApp class of MFC application with some name suppose XXXX.
and at the same time you check whether it is giving successful or fail
fail response. if it is successful then scheduler.exe is running first
time and if it is giving fail that means one instance is already running...
sonani prakash
|
|
|
|
|
if limiting your application to one instance is your need, you can try this ..
put this inside OnInitInstance()
if(FindWindow(NULL,"YourAppName")==NULL)
AfxMessageBox("1 and 1ly");
else
PostQuitMessage(0);
Regards,
V
|
|
|
|
|
NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER NEVER do this
Your GUI app will hang if another GUI app is hung!
The nearly seminal document on avoiding multiple instances is located here:
http://www.flounder.com/nomultiples.htm[^]
|
|
|
|
|
Vivekuniq wrote:
if(FindWindow(NULL,"YourAppName")==NULL)
AfxMessageBox("1 and 1ly");
else
PostQuitMessage(0);
better solution would be to try SingleTon classes or Naughter CSingleInstance class
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Has anyone read any good books or has good references on building kiosk apps?
Regardz
Colin J Davies
The most LinkedIn CPian (that I know of anyhow)
|
|
|
|
|
I don't think there are any books. By kiosk app, you mean what ? Something that's touch screen ? That plays media files ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yep,
The product I'm looking at building will have a barcode scanner, and play media files on a monitor.
Quite simple but I was wondering what other people have done, and problems encountered etc.
I want to stick with windows, But may have to switch to linux.
Actually I'm quite surprised that a customised XP shell is not on the market for Kiosk type projects.
Regardz
Colin J Davies
The most LinkedIn CPian (that I know of anyhow)
|
|
|
|
|
I've written a C# app that was a video jukebox, controlled by custom input devices ( not touch screen ). The only issues I had were with Managed DX ( it sucks ). The rest went like a dream, once I moved to the Windows Media Player control.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Popular Microsoft products including Office 2000/XP/2003 comes with a set of GUI themes. I wonder if these themes are supported by Windows system
or customarily created as library (toolkit) such as
"Prof-UIs", "extreme toolkitPro"?
If it the themes have to be created customarily that means toolkit have to mimic all the appearances and behaviors of Microsoft Office 2000/XP/2003, it seem a redundancy work for the application developer...
I'm looking forward for the answers
Thank you
|
|
|
|
|
Hi all,
I face a problem which when i run my program and click on display button,
then windows pop up "unable to open database"?
did my coding below got problem?
void CDisplay_Crystal_RPTDlg::OnDisplay() <br />
{<br />
<br />
UpdateData(TRUE);<br />
CCrystalCtrl *m_cryscontrol = <br />
( CCrystalCtrl*)( GetDlgItem(IDC_CRYSTALREPORT1));<br />
CString str;<br />
str = "{Table1.ID} = 1";<br />
<br />
m_cryscontrol->SetReportFileName("C:\\Documents and Settings\\Owner\\My Documents\\Bryan\\C++code\\Display_Crystal_RPT\\Report1.rpt");<br />
m_cryscontrol->SetSelectionFormula(str);<br />
m_cryscontrol->SetDiscardSavedData(TRUE);<br />
m_cryscontrol ->SetAction(TRUE); <br />
UpdateData(FALSE);<br />
}
|
|
|
|
|
i cant figure out why theres an access violation below
<br />
WCHAR t[] = "image/bmp";<br />
CLSID id;<br />
GetEncoderClsid(t, &id);<br />
<br />
Bitmap* bmp = 0;<br />
bmp->FromHBITMAP(hBmpFileBitmap,0);<br />
<br />
EncoderParameters encoderParameters;<br />
encoderParameters.Count = 1;<br />
encoderParameters.Parameter[0].Guid = EncoderQuality;<br />
encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;<br />
encoderParameters.Parameter[0].NumberOfValues = 1;<br />
<br />
ULONG quality = 100;<br />
encoderParameters.Parameter[0].Value = &quality;<br />
<br />
bmp->Save(t2,&id,&encoderParameters);
help would be appreciated
thanks a bunch
|
|
|
|
|
Tim Zorn wrote:
bmp->Save(t2,&id,&encoderParameters); //access violation here
What's t2 ?
Also, the FromHBitmap method is static on the class, and RETURNS the Bitmap object. Your Bitmap is probably still NULL.
Christian Graus - Microsoft MVP - C++
-- modified at 20:16 Thursday 15th September, 2005
|
|
|
|
|
ok thanks. but now when it saves its the right size but blank. i think it has something to do with the pallette can u tell me what it is and how to make one?
help would be appreciated
thanks
|
|
|
|
|
Tim Zorn wrote:
i think it has something to do with the pallette
The fact that you're setting quality makes me thing you're saving a jpeg. Only greyscale jpegs have a pallete, and it's fixed ( because it's greyscale ).
I'd break the process into steps. Load your image, then draw it on the screen. If it's OK there, then the problem is the saving code. Simplify that, and add stuff back in until it breaks.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i have the following struct:
typedef struct
{
TCHAR s1[20];
TCHAR s2[20];
int i;
TCHAR s3[5];
TCHAR s4[5];
TCHAR s5[10];
}stMyStruct;
notice that sizeof(stMyStruct) is exactly 64!
now, i open a reg key and try to set the value to that struct this is what i do:
HKEY hKey = NULL;
CString szSubKey = _T("Software\\Test\\MyTest");
LONG lRet = RegCreateKeyEx(HKEY_CURRENT_USER,
szSubKey,
0,
NULL,
0,
KEY_ALL_ACCESS,
NULL,
&hKey,
NULL);
if (lRet != ERROR_SUCCESS)
{
RegCloseKey(hKey);
ASSERT(FALSE);
}
DWORD dwType = REG_BINARY;
DWORD dwSize = 64;
lRet = RegSetValueEx(hKey,
_T("MyValue"),
0,
dwType,
(LPBYTE)&pInfo,
dwSize);
RegCloseKey(hKey);
i see new entry in the registry, but i am not sure it is valid!!
now i try to read the value using this code:
stMyStruct* pInfo = NULL;
HKEY hKey = NULL;
CString szSubKey = _T("Software\\Test\\MyTest");
LONG lRet = RegOpenKeyEx(HKEY_CURRENT_USER,
szSubKey,
0,
KEY_READ,
&hKey);
if (lRet != ERROR_SUCCESS)
{
RegCloseKey(hKey);
}
DWORD dwType = REG_BINARY;
DWORD dwSize = 64;
lRet = RegQueryValueEx(hKey,
_T("MyValue"),
0,
&dwType,
(LPBYTE)&pInfo,
&dwSize);
if (lRet != ERROR_SUCCESS)
{
RegCloseKey(hKey);
}
here nothing fails but the pInfo data members are invalid!!!
any help?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote:
(LPBYTE)&pInfo
If pInfo is a pointer to the data, you want to pass pInfo , not &pInfo (note the extra "&"). Currently you're passing the address of the address of the data structure.
|
|
|
|
|
nicely said! will try that and let you know
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
ok it worked fine...
just wanted to ask you an other thing
suppose i have a key in the registry called "MyKey" and i have binary values each of them is called "MyVal"
i want to enumerate those values and read into my struct these values
i saw in the MSDN there is a method called "KeyEnum
DWORD dwType = REG_BINARY;
DWORD dwSize = sizeof(stMyStruct);
DWORD dwIndex(0);
DWORD dwValSize = 6; // size of MyVal
while (ERROR_NO_MORE_ITEMS != RegEnumValue(hKey,dwIndex,
_T("MyVal"),&dwValSize,0,&dwType,(LPBYTE)pInfo,&dwSize))
{
AddNewInfo(pInfo);
}
problem is i get an assert using this code...
can u help again?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|