|
Here is some additional information and a breakdown on how this project got here.
I have been developing a CDialog program that displays aircraft data and is used as a display program to analyze radar problems. This is a stand alone program that was written in Visual C++ MFC with modul and non-modul dialog boxes. I used STL to store the data in memory and massage the data with certain tasks.
I was tasked to write programs such as a Scan Analyzer and Tracker program.
So I went ahead and wrote them as stand alone programs in Visual C++. They originally both had CDialog boxes and I did all the r&D in VC++ GUI and once I was done I stripped all the GUI code from them and ported them over to be Library's to be attached to the Main Project as analysis tools. So I was successful in doing so in Release mode but the Debug mode just doesn't work. The Release mode does everything it should do and has no problems at all but the Debug mode is in bad shape.
Project settings are as follows for each program
1) WinTAP Program (Main program) under projects settings is:
Release and Debug mode is "Use MFC in Static Library"
1) The Tracker Program under projects settings is :
Release and Debug mode "Use MFC in Shared DLL"
2) Scan Analyzer Program under project settnigs is:
Release and Debug mode "Use MFC in Shared DLL"
Many thanks in advance for all your help.
Yours
ndfspeed
|
|
|
|
|
ndfspeed1971 wrote: 1) WinTAP Program (Main program) under projects settings is:
Release and Debug mode is "Use MFC in Static Library"
For MFC extension DLLs you should use "Use MFC in Shared DLL" for the main program as well.
You may have a problem using two instances of MFC at the same time.
Extension DLLs[^]
|
|
|
|
|
#include <stdio.h>
void main()
{
int n;
printf("Enter digit (0 to 100) > ");
scanf("%d", &n);
while(n < 0 || n > 100)
{
printf("Invalid! Reenter > ");
scanf("%d", &n);
}
//shows message if n != digit (ask for reenter)
printf("You had entred %d\n", n);
}
sorry, I'm new....
|
|
|
|
|
You need to initialize the ‘n’ variable, because if the first call to ‘scanf’ fails the value will still be undefined.
How you are using ‘scanf’ will only convert digits, otherwise it failes, and you should check the return value of the function to determine if it was successful.
Your ‘while’ will not exit until a value has been enter in the required range, so there is no reason to check after the loop has exited.
If you really want to verify each digit as it is entered, then you will need to gather the digits one at a time, in to a character buffer, and call ‘isdigit’ to check each character as it is entered. After gathering digits, use ‘atoi’ to convert it to ‘int’ and then check the range. (Do not forget to make sure the character buffer ends with character ‘\0’.)
Simplified version of your code:
void main()
{
int n = 0;
while(n < 0 || n > 100)
{
printf("Enter digit (0 to 100) > ");
scanf("%d", &n);
if(n < 0 || n > 100)
printf("Invalid! Reenter digits >\n");
}
}
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I use App-Wizard to create project that derive from CEditView.(It look like NotePad).
My problem is that when the character have change by using the function for edit charactor such as CString::Delete(), CString::Insert()...
At menu Undo it isn't Active.
It look like, It don't know the character have change.
Can anyone help me for solve this problem?
|
|
|
|
|
What function you are using to set text to edit control ?
Because, calling SetWindowText or SetHandle clears the Undo flag.
|
|
|
|
|
|
Please tell me if you have another way to set text to EditCtrl
|
|
|
|
|
Use ReplaceSel , in combination with SetSel .
Edit.SetSel(0,-1);
Edit.ReplaceSel("PRASAD",TRUE);
|
|
|
|
|
use ReplaceSel instead.
This method replaces the current selection.
If you want to replace the whole text, use SelSel() before.
|
|
|
|
|
Hi All ,
I am creating the SDI application for showing the Operating system’s drive explorer tree.
This is working fine for all operating system from Win 2K to XP for 32 Bit.
But If I check it for Windows XP 64 bit operating system then It is showing strange behave , my all hierarchy of files and folders is coming properly but Files and folder of C:\windows\system32 directory are not coming properly , here it is showing the files and folders of C:\windows\systemWOW64 directory.
How to show the actual files and folder of C:\\Windows\\system32 directory ????????
I am using the following code snippet.
ShowFileFolder (CString strPath )
{
HANDLE hInstance;
BOOL bContinue=FALSE;
WIN32_FIND_DATA fatr;
int iCheck=0;
int iLocation;
if(strPath.GetAt(strPath.GetLength()-1)!='\\')
strPath=strPath+_T("\\");
if(strPath.GetLength()==3)
iCheck=1;
strPath=strPath+_T("*");
hInstance=FindFirstFile(strPath,&fatr);
do
{
bContinue=FindNextFile(hInstance,&fatr);
if(!(wcscmp(fatr.cFileName ,_T("."))==0) && !(wcscmp(fatr.cFileName,_T(".."))==0) && bContinue)
{
if(fatr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if((iLocation=strPath.ReverseFind('*'))!=-1)
strPath=strPath.Left(iLocation);
ShowFileFolder (strPath);
//AddItemToTree(strPath) ;
}
else
{
if((iLocation=strPath.ReverseFind('*'))!=-1)
strPath=strPath.Left(iLocation);
//AddItemToTree(strPath) ;
}
}
}while(hInstance && bContinue);
FindClose(hInstance);
}
ShowFileFolder (“ C:\\Windows\\system32 ”) and ShowFileFolder (“ C:\\Windows\\systemWOW64 ”) showing the same file folder hierarchy but actually both have diff file folders on Windows XP 64 bit OS
Regards
|
|
|
|
|
ashtwin wrote: my all hierarchy of files and folders is coming properly but Files and folder of C:\windows\system32 directory are not coming properly , here it is showing the files and folders of C:\windows\systemWOW64 directory
This is the correct behavior. Win64 virtualizes some parts of the file system and registry for Win32 apps for compatibility reasons. You can disable this feature by calling Wow64DisableWow64FsRedirection()
|
|
|
|
|
Thanks it is working correctly now.
|
|
|
|
|
Hi,
I need to add a UDP multicast ability to my application.
The problem is that i can send data to the other computers in my group,
but i can't get data from the other computers.
Where can I find a good example for UDP multicast?
I tried googling but can't find a good example.
With best regards,
Eli
|
|
|
|
|
How are you trying to "get data from the other computers"?
Are they sending multicast packets as well?
|
|
|
|
|
Dear All,
I want to stop user interaction with dialogs.
How can i do this ?
Thanks.
bye.
|
|
|
|
|
What do you want to achieve ,exactly ?
|
|
|
|
|
Hi.,
I am doing a remotly managable program. There I want to manage a dialog application that is at client side. Client application having some buttons, menu and all.
I want to disable application window interaction from user so as to user can not modify any changes on that application dialog.
But it shows the status or some stable text. thats it.
Bye.
|
|
|
|
|
Sakthiu wrote: I want to disable application window interaction from user so as to user can not modify any changes on that application dialog.
But it shows the status or some stable text. thats it.
Whats problem then ? If you are showing information as text.
If you are worried about buttons to be clicked( I'm not sure, if they are there), you can always handle them.
|
|
|
|
|
i have two questions.
1)I need to count the items in the list view.
in my project i opened the file dialog and that selected file is display in the
listview if the same file is selected it gives message of duplication of file.
2)i want to set the default value in combo box.
i am using win32 in .net enviorment.
thanks with
amit
|
|
|
|
|
amitmistry_petlad wrote: 1)I need to count the items in the list view.
Use ,
SendMessage( (HWND) hWnd, LB_GETCOUNT, 0,0);
amitmistry_petlad wrote: 2)i want to set the default value in combo box.
I'm not sure, what you want to do ?
|
|
|
|
|
thank you ,gives the count value zero when i debug it.
will it work for listview?
i am not sure but i think it is for listbox not for listview control.
because the listview has some columns so i think we have to find the column number first and then we have to count the items.is it?
do you have any artical on the base of list view count items ? or link?
amit
|
|
|
|
|
amitmistry_petlad wrote: am not sure but i think it is for listbox not for listview control
Yes it is.
For list view , you can use,
SendMessage(hView,LVM_GETITEMCOUNT ,0,0);
|
|
|
|
|
still gives the zero value, after adding files in the listview
here is the code
case CBN_SELCHANGE :
int iCheck = (int)SendMessage((HWND)GetDlgItem(hDlg , IDC_COMBO1 ), CB_GETCURSEL, (WPARAM)0, (LPARAM)0);
if(iCheck !=0)
{
if(iCheck != 2)
{
uploadedFile = util.GetFile(NULL);
}
else
{
uploadedFile = util.BrowserDirectory();
if(uploadedFile != "")
uploadedFile += "\\";
}
if(uploadedFile != "")
{
//Check if the item is already added or not
HWND hwndListbox = GetDlgItem(hDlg,IDC_LIST4);
LRESULT iCount = SendMessage(hwndListbox,LVM_GETCOLUMN,0,0);
bool valid = true;
if(iCount > 0)
{
for(int i=0;i<iCount;i++)
{
WCHAR szInputFile[MAX_PATH];
SendMessage(hwndListbox,LB_GETTEXT,i,(LPARAM)szInputFile);
if(wcslen(szInputFile) > 0)
{
string sIn = util.ConvertWCHARToString(szInputFile);
if(sIn == uploadedFile)
{
valid = false;
MessageBox(hDlg,_T("This item is already added to the list."),_T("Encode"),MB_ICONINFORMATION);
break;
}
}
}
}
amit
|
|
|
|
|
amitmistry_petlad wrote: //Check if the item is already added or not
HWND hwndListbox = GetDlgItem(hDlg,IDC_LIST4);
LRESULT iCount = SendMessage(hwndListbox,LVM_GETCOLUMN,0,0);
It is lisbox , I guess. Then you need to use, LB_GETCOUNT wioth SendMessage .
Does list box contains some item ?
|
|
|
|