|
In the case of SDI MFC project, how could I remove the WS_THICKFRAME style?
|
|
|
|
|
lucy wrote:
In the case of SDI MFC project, how could I remove the WS_THICKFRAME style?
Override PreCreateWindow
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
For prevent re-sizing:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style = WS_DLGFRAME ;
return TRUE;
}
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Oh, yep, this works like a magic. I added one more style
WS_SYSMENU so that on the title bar, I have the small "X" to close the program.
Thank you, all you guys.
|
|
|
|
|
I have a dialog box in which I have a group of two radio buttons and I have an edit box which takes an int as the # of files to open. I also have many other edit boxes with browse buttons to look for a file that should be opened. When I select one of the radio buttons and then put a number in my edit box for integers, the selections don't remain there after I do something else in the dialog box. Such as if I click one of the browse buttons to find the file and then place it in the appropriate other edit box, the radio button gets deselected and the number in the edit box disappears. How can I make the number and the radio button selection remain?
|
|
|
|
|
|
Hello,
I'm writing code to control mechanical syring pump and using the predefined functions written in the .lib file and .dll file provided by the company. I'm new to visual c++ .net and I don't know how to include .lib file into the project. Can anyone help my on this? I try to add it directly in the Resource Folder but it says that the file is invalid and it never shows up as something to add in the first place. Any help would be appreciated. Thanks in advance/
|
|
|
|
|
Project--->proprerties--->Linker---->Additional Dependencies
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I am trying to create an MFC application that uses a List Control Box in a pop-up dialog box. When a Button is pressed in a pop-up dialog box a List Control Box is supposed to be populated with information from an Access database. However when the Button is pressed the program just hangs and is unresponsive.
But the puzzling thing is that when the exact same code is used on the main dialog (IDD_MAIN_DIALOG) to an identical List Control Box and Button it works perfectly, with no hanging. I have included the code for the Pop-up dialog box.
Any help is greatly appreciated
Aoife
*****************************************************
#include "stdafx.h"
#include "Main.h"
#include "DialogBoxDlg.h"
#include "afxdb.h"
#include "odbcinst.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialogBoxDlg dialog
CDialogBoxDlg ::CDialogBoxDlg (CWnd* pParent /*=NULL*/)
: CDialog(CDialogBoxDlg ::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialogBoxDlg )
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDialogBoxDlg ::DoDataExchange(CDataExchange*pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialogBoxDlg )
// NOTE: the ClassWizard will add DDX and DDV calls here
DDX_Control(pDX, IDC_SMS_MYLISTCONTROL,m_SMSMyListControl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialogBoxDlg , CDialog)
//{{AFX_MSG_MAP(CDialogBoxDlg )
ON_BN_CLICKED(IDC_BUTTON, OnButtonPressed)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialogBoxDlg message handlers
void CDialogBoxDlg ::OnButtonPressed()
{
CDatabase database;
CString SqlString;
CString sNumber, sSender, sDate, sMessage;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "c:\\THEPROJECT\\Interface\\Project_Databases.mdb";
int iRec =0;
//Build ODBC connection string
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);
TRY
{
//Open the Database
database.Open(NULL,false,false,sDsn);
//Allocte the Record set
CRecordset recset (&database);
//Build the SQL statement
SqlString = "SELECT Number, Sender, Date, Message "
"FROM pc_Inbox";
//Execute the query
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
//Populate the Grids
ListView_SetExtendedListViewStyle(m_SMSMyListControl,LVS_EX_GRIDLINES);
//Column width and heading
m_SMSMyListControl.InsertColumn(0, "SMS No.",LVCFMT_LEFT, -1,0);
m_SMSMyListControl.InsertColumn(1, "Sender",LVCFMT_LEFT, -1,1);
m_SMSMyListControl.InsertColumn(2, "Date",LVCFMT_LEFT, -1,2);
m_SMSMyListControl.InsertColumn(3, "Message",LVCFMT_LEFT, -1,3);
m_SMSMyListControl.SetColumnWidth(0, 100);
m_SMSMyListControl.SetColumnWidth(1, 100);
m_SMSMyListControl.SetColumnWidth(2, 100);
m_SMSMyListControl.SetColumnWidth(3, 200);
//Loop through each record
while (!recset.IsEOF())
{
//Copy each column into a variable
recset.GetFieldValue("Number",sNumber);
recset.GetFieldValue("Sender",sSender);
recset.GetFieldValue("Date",sDate);
recset.GetFieldValue("Message",sMessage);
//Insert values into the list control
iRec = m_SMSMyListControl.InsertItem(0,sNumber,0);
m_SMSMyListControl.SetItemText(0,1,sSender);
m_SMSMyListControl.SetItemText(0,2,sDate);
m_SMSMyListControl.SetItemText(0,3,sMessage);
//Go to the next record
recset.MoveNext();
}
//Close the Database
database.Close();
}
CATCH(CDBException, e)
{
//If a database exception occured, show an error message
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
}
|
|
|
|
|
Um... have you tried stepping into OnButtonPressed() ? Where does it hang?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Please be patient with me, I'm a student!
I have tried stepping into it, but...
I decided to step through the Button and List Control box (In the Main Dialog)that works properly so that I could see how that one worked. But while stepping through it pop-up boxes appear requesting that I find the source for certain .C files. I searched my computer for them but couldn't find them. I do have MSDN VC++ libraries installed. If I cancel out of these boxes the debugger starts going through Assembly code.
Why does this happen while debugging, when that part of the application works properly when the application is executed?
So I can't debug the OnButtonPressed() because the same Find Source pop-up boxes appear.
|
|
|
|
|
After a quick lesson in debugging..
I have found that it is hanging on this line,
//Populate the Grids
ListView_SetExtendedListViewStyle(m_SMSMyListControl,LVS_EX_GRIDLINES);
|
|
|
|
|
Perhaps it's dying because you haven't yet inserted the columns? Try setting the LVS_EX_GRIDLINES style after you define the control's columns. Hope this helps!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi there,
I am using the ADO calls to connect to my database and have the following call:
_variant_t varFieldValue;
varFieldValue = m_pRecord->Fields->GetItem((long)nCol)->GetValue();
Now, at some point , I like to convert this varFieldValue to a string, preferably a STL string.
Any tips on how to do this?
thanks
|
|
|
|
|
this should get your variant value into a CString.
CString strTest;
strTest = varFieldValue.bstrVal;
|
|
|
|
|
Nope, that won't work if the variant isn't already a VT_BSTR.
However using static_cast <_bstr_t> (v) will convert the variant to a BSTR and return the string.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I'm already familiar with the basics of c++ like pointers, multiple inheritance,... but nothing with "windows".
For the last couple of years, I've been programming in java, and I dare to say this, I know it all (almost ).
My question is this: Are there any migration tutorials for java -> c++/vc++?
Bluute tette!
|
|
|
|
|
i know where you are coming from, i developed in java for a year er so.. switched to VC++ a few months ago.. i think once im done with my current project ill be switching to C#.. maybe you should take a look at it as well..
-dz
|
|
|
|
|
The only ide that I've got is visual studio 6, so I'll probably stick to it.
Actually, I don't know c# at all, so I'm gonna take a look
Bluute tette!
|
|
|
|
|
Windows is an event driven environment, virtually identical to AWT. MFC is a thin object oriented layer over the Win32 API. The development tools (esp. the resource editor) are nicer than tools used to develop Java.
You might find C# to be a better migration path. It's more in line with Java - similar syntax, concepts and a reasonably extensive (imho) class library.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I have a socket client which will send data ( raw bytes followed by HTTP request) to the IIS server.
EX: the packet would be something like this,
"Binarydata(96 bytes)GET /myserver/myserver.asp?val1=v1&val2=v2 HTTP1.0 /n/n"
The above data represents some Binarydata of 96 bytes followed immediately by HTTP request reaching the
server page myserver.asp through the IIS Server.
If this data is sent directly( without filter) from the socket client to the Server , the IIS server would not interpret the
request, as the actual "GET" request is preceeded by some Binarydata.
I need help in the approach for developing an ISAPI Filter which satisfies the following criteria,
1. The ISAPI dll would run in between the IIS server and the Socket Client application.
2. It would capture all the bytes that is sent from the Socket Client application to the IIS server, strip out the 96 bytes & process it.
I would also like to know if ISAPI is the right approach.
Thanks for reading . Eagerly Expecting replies
regards
raja
|
|
|
|
|
I'm trying to update the filename extension on the Filesave dialog box from the OFNOTIFY whenever I select a filetype in the combobox.
Thanks
|
|
|
|
|
Hi all,
What's the best collection class for CPoint objects?
Index is not important, only i need is tail and head.
Thank you.
|
|
|
|
|
hi!
2 questions about UNICODE:
1. I have to convert char* based strings into TCHAR* (that is UNICODE) ones. THe Macro _T() only works for immediate strings such as "Hello" but not with variables, and a cast in (TCHAR *) or even (unsigned short*) mostly destructs what is written in the string (i.e. i got garbage in my string instead of hello, which i think is quite normal.). Any suggestion ?
2. Does it exist an equivalent to atoi() for UNICODE strings ?
Thanxx
RaGe
Unfortunately, brute-force solutions tend to be slow
even when performed by modern-day microcomputers,
which are capable of several MIPS except when I'm late
for an appointment and want to finish a compile and
run just one more test before I leave, in which case
the crystal in my computer is apparently designed to
automatically revert to 1 Hz.
-- Michael Abrash
|
|
|
|
|
Well, first TCHAR is not a UNICODE. It will be converted to unicode only if you compile your program as unicode.
If you want to convert ANSI to UNICODE and vise versa strings, I'd suggest to use bstr_t class. It excepts both and can return both of types.
As for atoi for unicode, so it is wtoi or _ttoi for TCHAR (determined in time of compilation)
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|