|
How can I prevent my app from being closed (Other than from the task manager)?
What messages can I trap to prevent it from closing?
|
|
|
|
|
OnClose ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I shouldve said it was an SDI app. On close wont work there will it?
|
|
|
|
|
Why not ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I have some code here that I have been playing with to implement a elevator's computer. I have everything kind of mapped out in my head how it's going to work but am having a problem with converting a char to an int. I would like to send the char c to the thread "move( )" and use it as an int. So bacically, How do I convert a char to an int using only djgpp compiler and multi-c operating system.
Here is what I am working with.
void move(char c)
{
}
void getFloor(void)
{
DWORD32 timeout;
short c;
for(;;)
{
BYTE8 floor;
SetCursorPosition(8,10);
while(!ScanCodeRdy())
MtCYield();
floor=GetScanCode();
if ( !(floor & 0x80) )
{
c=ScanCode2Ascii(floor);
PutString(" Floor ");
PutChar(c);
}
}
}
|
|
|
|
|
Conversion between int and char is implicit in C++, dunno about C. But surely a cast will do it ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
90% of the what is true in C++ is also true in C, minus class support. In other words, the conversion is implicit in C too. Take away class support and the ability to add member functions to structures and what you have is C with much better syntax checking.
INTP
|
|
|
|
|
what elevator company do u work for?
*makes a note not to ride in those elevatots*
"there is no spoon" biz stuff about me
|
|
|
|
|
After a lot of hard work and a lot of messing around i finally finished my Layered Service Provider. So i went to test it on another machine running Win98 (i'm running XP). But WHOA arghhhh its not working right!!! It just wont install the Service provider! I read everywhere on the web that LSP's work on win98 too as long as you have Winsock 2 installed. And that machine did! But sceptic as we are, we install the Winsock2 update again, wham error: something about an unsupported operating system version. But its Win98! So i tried it on ANOTHER win98 machine, same error. ???? I'm really confused. Can anyone tell me how to get an LSP to work on Win98??
Kuniva
--------------------------------------------
|
|
|
|
|
Hi. What I want to do is create an application (Doc/View app) that does this:
1) places a widget on the (Doc/View) drawing area
2) allows the user to drag the widget to another area on screen
3) when widget is double-clicked, a new "window" opens - could be a dialog, or another View window.
4) point-click to connect widgets with a line
I did a quick search in CodeProject and found the DDRmgr example,
Drag-Drop Manager for CObjects by Wes Rogers (http://www.codeproject.com/clipboard/ddmgr.asp?target=drag%7C%2Bdrop)
but want more/another example.
Can anyone help with this?
Thanks,
Johnny
|
|
|
|
|
I have a crude example (in Flash 6, 4.5kb) if want to see more details.
-- regards, Johnny
|
|
|
|
|
OK...here is my problem...
I have an mdi aplication vith a toolbar. The toolbar has 3 buttons. any of this 3 buttons open a different view window.
button 1 -> view hith a combobox
button 2 -> view with a editbow
button 3 -> view with a list control.
so far so good. My problem is that i must "erase" the close minimize and maximize buttons form the title bar and I don't know where to do it. I tried in CMDIChildFrm :: OnPreCreateWindow to modify the cs but I managed to do that only for my first window that I open. When I open the other 2 buttons they still have the max, min and close buttons.
Question is Where and how I must define the style for all 3 view windows so that when I create them they will be created without the min, max & close buttons.
sorry for my bad english
|
|
|
|
|
Good English, very good infact!
Set a pointer to the window (the button) GEtSafewh...
The show or hide them at will.
Best Wishes,
ez_way
|
|
|
|
|
In a dialog based program ,I have a default constructor like this:
CUpdateRcrd::CUpdateRcrd(CWnd* pParent /*=NULL*/)
: CDialog(CUpdateRcrd::IDD, pParent)
{
//{{AFX_DATA_INIT(CUpdateRcrd)
m_vtName = _T("");
m_vtPass = _T("");
m_vtUsername = _T("");
m_vtUrgent = _T("");
m_vtPhone = _T("");
//}}AFX_DATA_INIT
}
I wanna add and use my own constructor.A constructor that takes one integer argument.I add my own constructor via member function and made an instance of my object,using the new constructor.but the appliction crashed at run time.Can anyone help?It's a matter of life and death.
|
|
|
|
|
|
You could just add an interger argument to the origanal constructor thus:
CUpdateRcrd::CUpdateRcrd(CWnd* pParent /*=NULL*/, int n /*=0*/)
You could make a copy (cut & paste) of the origanal and use it as a bases for your new constructor.
You could pull out the intialization code from the origanal constructor and store it in a sperate member function that is call by all additional constructors that you create.
No matter how you go about it, what ever the origanaly constructor is doing you must do the same thing in any constructor you create. If you are not doing this then some thing is not being initialize to a known state durring construction and a what do you know it crashes.
INTP
|
|
|
|
|
Hi, im considering learning about writting apps for the palm os, and i have found tons of info, APIs, etc. but i cant seem to find exacly WHAT do i need to compile this kind of applications.
Can VC6 be used for this? or do i need to get (aka BUY) another IDE, compiler, etc.?
Thanks!
|
|
|
|
|
The best bet is to buy another IDE such as CodeWarrior or look for similiar IDEs in the GNU community.
I'm not familiar with the latest Palm OS (past ver 4.1), but the Palm OS is/was based upon the Motorola processor. The apps one writes and places on the Palm are embedded system applications.
If you are only writing Conduits (the apps that handle updating the Palm/PC during a HotSync), then VC++ IDE can do the job for you.
More info?
Johnny
|
|
|
|
|
|
Falch.NET is a better IDE than Code Warrior because it is cheaper, and looks like VC6. Code Warrior is annoying to use, although it may be just that it was unfamiliar. As Michael said, try searching first, there's a whole section here on Palm articles.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
When I am coping/pasting from my c++ program to the notepad the \n's are not coming through.
I get little squares instead of carriage returns.
The string is unicode, but it does not work even when I save-as notepad file as unicode.
Do you know what the problem is and how I can get around it?
ANy help would be greatly appreciated.
Here is my code that puts the string on the clipboard:
void OnCopyButtonClicked()<br />
{<br />
CString strData;<br />
CString strWarningHeader, strErrorHeader, strInfoHeader;<br />
<br />
strWarningHeader.LoadString(IDS_INVENTOR_WARNING_LABEL); <br />
strErrorHeader.LoadString(IDS_INVENTOR_ERROR_LABEL);<br />
strInfoHeader.LoadString(IDS_INVENTOR_INFO_LABEL);<br />
<br />
std::vector<InventorErrorMessageStruct>::iterator iter;<br />
for (iter = m_errorStructList.begin(); iter != m_errorStructList.end(); ++iter)<br />
{<br />
InventorErrorMessageStruct messageStruct = (*iter);<br />
<br />
if(strData.GetLength() > 0)<br />
{<br />
strData.Insert(strData.GetLength(), _T("\n\n"));<br />
}<br />
if(messageStruct.messageType == CErrorListBox::MESSAGE_ERROR)<br />
{<br />
strData.Insert(strData.GetLength(), strErrorHeader);<br />
}<br />
else if(messageStruct.messageType == CErrorListBox::MESSAGE_WARNING)<br />
{<br />
strData.Insert(strData.GetLength(), strWarningHeader);<br />
}<br />
else if(messageStruct.messageType == CErrorListBox::MESSAGE_INFO)<br />
{<br />
strData.Insert(strData.GetLength(), strInfoHeader);<br />
}<br />
strData.Insert(strData.GetLength(), _T(" "));<br />
strData.Insert(strData.GetLength(), messageStruct.message); <br />
}<br />
<br />
if (OpenClipboard())<br />
{ <br />
EmptyClipboard();<br />
<br />
HGLOBAL hClipboardData;<br />
hClipboardData = GlobalAlloc(GMEM_DDESHARE, <br />
(strData.GetLength() + 1) * sizeof(wchar_t)); <br />
<br />
wchar_t* pchData;<br />
pchData = (wchar_t*)GlobalLock(hClipboardData);<br />
<br />
wcscpy(pchData, LPCTSTR(strData)); <br />
GlobalUnlock(hClipboardData); <br />
SetClipboardData(CF_UNICODETEXT,hClipboardData);<br />
CloseClipboard();<br />
}<br />
}
Elena
|
|
|
|
|
Hi
Try this please
Make a new dlg project and place a button and a edit contrrol on it. Do NOT make the edit control multi-line.
Name a str member var for the edit control named say m_strEdit.
Add the following to the button.
OnBottonClick()
m_strEdit.Format("hello world\r\n hello world\n hello world\r");
Update Data(FALSE);
Easy right?
Now copy the contents of your editcontrol to notepad and see what you get.
Answered your own question,,, right?
Best Wishes,
ez_way
|
|
|
|
|
It has been a while, but a think that you need to use "\r\n" (a.k.a. CR/LF)at the end of each line of text that you are copying to the clipboard, not "\n". When you are working with edit controls, or an CEditView derived class, you will find out very quickly that it does not recognise "\n" and does recognise "\r\n".
INTP
|
|
|
|
|
I want to continually update the data in the edit boxes on my dialog box with data that is generated in a loop. For example:
for( i=0; i<100; i++)
{
m_X += 1;
UpdateData(FALSE);
}
However, when I try this it loops through the for loop and doesn't display the values until it reaches the end of the loop. Thats when it displays 100.
Any help would be appreciated. Thanks
|
|
|
|
|
The problem is that the thread that executes your for loop is the same thread that draws the GUI of your app. In order to solve your problem you have to create a workerthread. That thread must have a way to comunicate with your gui.
If your ussing MFC the safe way to do it is passing the HWND of the dialog box or the HWNDs of the controls you want to update and use SendMessage/PostMessage to update their contents.
To create a worker thread ( a worker thread does not handle any UI events, it does not own a window ) you can call:
CWinThread* AfxBeginThread(
AFX_THREADPROC pfnThreadProc,
LPVOID pParam,
int nPriority = THREAD_PRIORITY_NORMAL,
UINT nStackSize = 0,
DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL
);
pfnThreadProc - this is your thread function,it has the following proto:
UINT MyControllingFunction( LPVOID pParam );
pParam - can be anything you want, and it is what you recive in pParam in MyControllingFunction (usualy in MFC a HWND)
"I don't want to achieve immortality through my work... I want to achieve it through not dying."
Woody Allen
|
|
|
|