|
You could use PostMessage() to send a user defined message to the app. I assume the serial port stuff is running in a thread. Also have a look at articles here on CP re. serial ports.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
You need to have a second thread in your application that checks for events. I am not sure if the website that you are listing is the same that I have looked at 3 years ago but if it is, they list all the functions needed. The main problem is that you need to have a thread that checks your port.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I have a client who is installing an NT Service on a W2K server in a Novell network. The can install but are unable to start the service. I don't have any Novell experience...yet!
My gut reaction is that Novell may require the user the service runs under to have some special permissions. Any ideas or guidence on where to look to solve this?
Thanks,
ed
Regulation is the substitution of error for chance.
|
|
|
|
|
Does anyone know how to automatically perform a funcion when a dialog appears, such that in the function you can update an edit control and the user can see the update? I basically need to perform a function when the dialog is loaded, and throughout the function it sends updates to an edit box to display the status of the function. I tried placing a call to the function in OnInitDialog() but the dialog doesn't paint until after the function has returned. Does anyone know how to do this?
|
|
|
|
|
At the tail-end of OnInitDialog(), use PostMessage(). This will place a message in the dialog's message queue, but still allow OnInitDialog() to return.
|
|
|
|
|
i am a novice myself, but if i understand you correctly this is the answer to your question.
use the function SetDlgItemText(int nID,LPCTSTR lpszString);
for example:
i call a function which writes to a CEdit control from OnInitDialog() in one of my applications, this is how i display text in the edit box.
SetDlgItemText(IDC_YOUR_EDIT_CONTROL,yourString)
or using the class wizard you can assign a CString variable to the edit control.
Once you do this you will it be defined in the header file.
//header
CString yourEdit;
then in your OnInitDialog() do the following:
//cpp
yourEdit = yourString;
UpdateData(TRUE);
I hope this is what you asking for
|
|
|
|
|
Desanto is correct on how to replace all text in the edit control in OnInitDialog().
It also appears you want to receive more updates after the dialog is loaded. One way of doing that would be to start a timer using SetTimer() and handle the WM_TIMER message, so you can check if an update is required.
1) if you want to replace all text call SetDlgItemText().
2) If you want add to the current text then you have to A) use EM_SETSEL (CEdit::SetSel()) to set current selection to end of currently displayed text [it might already be set there by last write], B) use EM_REPLACESEL (CEdit::ReplaceSel()) to insert the new text you want to add [followed by CR/LF].
Hope this helps.
Trust in the code Luke. Yea right!
|
|
|
|
|
I'm doing the following
#include <fstream.h>
then later
fstream fin;
and it gives me this error.
C:\parsells\C++ Testing\ccode\odbc_stuff\odbc_stuff.cpp(137) : error C2872: 'fstream' : ambiguous symbol
there is other code in there as well, but that is where it says the error is.
ICXC
NIKA
|
|
|
|
|
scope?? are you 'using namespace std?'
std::fstream
ed
Regulation is the substitution of error for chance.
|
|
|
|
|
when I put in the std:: infront of the the fstream the error changes.
I wrote this code and compiled it on it's own and it all worked, now when I'm trying to merge it into some code that I downloaded it doesn't work. here's what I'm doing.
std::fstream fin;
fin.open(filename,ios::in | ios::nocreate);
the errors I get are:
odbc_stuff.cpp(30) : error C2079: 'fin' uses undefined class 'basic_fstream<char,struct std::char_traits<char=""> >'
odbc_stuff.cpp(31) : error C2228: left of '.open' must have class/struct/union type
odbc_stuff.cpp(31) : error C2039: 'nocreate' : is not a member of 'basic_ios<char,struct std::char_traits<char=""> >'
odbc_stuff.cpp(31) : error C2065: 'nocreate' : undeclared identifier
I don't get it. I thought I was doing a standard file open.
ICXC
NIKA
|
|
|
|
|
I created a Win32-based (MFC, ATL and ActiveX support via wrappers) control a while back. The thing is generally useful, and I find myself using it quite a bit. The problem is that I have to constantly refer to the headers to find message and notification declarations, and then hand-code the message maps, etc.
I'd really like VS.Net to automagcially support my class as well as it does, say, COMBOBOX. Is there a way to declare the interface of my control to VS so that it can add the appropriate stuff to the "events", "messages" and "overrides" section of the properties window (shown when a class is selected in Class View. I'd really like it to work when a member of my control class is added to a dialog, AND when I use CCtrlView with my class.
Anyone have experience with this? Or, at least know where this stuff is documented?
Thanks,
|
|
|
|
|
Hi,
Here is my problem. I have a MDI App that countain some modeless dialogbox. I would like to make sure that my dialogs are always withing the boundary of my mainframe. Also, I would like to find a way that my dialogs follows the MDI App when I move the mainframe.
Any Ideas?
thanks
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Have u tried using CWnd::MoveWindow for your modeless dialog?
|
|
|
|
|
MemLeak wrote:
Also, I would like to find a way that my dialogs follows the MDI App when I move the mainframe.
If you make the modeless dialog a "child dialog" via the properties in the resource editor, it should follow the mainframe when called with create() and ShowWindow(SW_SHOW).
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
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.
|
|
|
|
|