|
C:\My Documents\DataStru\Investors.cpp(7) : error C2653: 'Investors' : is not a class or namespace name
can anyone tell me why does it give this error? PLEASE
i have "investors.h" included in investors.cpp but it's still giving me this error
thank you
|
|
|
|
|
|
hi
I have loaded a CComboBox object m_combo with the list of drives using DirDlgListComboBox.I also used SetCurSel(0) to display the first element
in the loaded list.Now i want to display all the loaded data when somebody clicks on the dropdown arrow.So i added an event CBN_DROPDOWN .In the handler i added this line of code
m_combo.ShowDropDown();
This gives an unhandled exception.I have just started MFC programming .So if anybody can tell me why this happens and also suggest me to make it work correctly.
|
|
|
|
|
Combo boxes will dropdown when you click on the arrow by default. You don't need any extra code to make this work.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
CString *temp1 = new CString("");
LPTSTR str1 = temp1->GetBuffer(temp1->GetLength());
int ret=this->DlgDirListComboBox(str1,IDC_DIRCOMBO,0,DDL_DRIVES);
if(ret==0)
{
DWORD i=::GetLastError();
}
int n=m_list1.GetCount();
//m_combo.SetCurSel(1); //default data is not displayed in comboBox is this is not done.
ret=m_combo.GetLBTextLen(1);
m_combo.GetLBText(1,m_list);
m_list.Delete(0,2);
m_list.Delete(1,2);
ret = m_list.GetLength();
m_list+=":\\";
str1 = m_list.GetBuffer(m_list.GetLength());
ret=this->DlgDirList(str1,IDC_LIST1,0,DDL_EXCLUSIVE|DDL_DIRECTORY);
if(ret==0)
{
DWORD i=::GetLastError();
}
//LPCTSTR t = m_list;
//m_list1.AddString(t);
m_list1.SetCurSel(0);
n=m_list1.GetCount();
Invalidate();
m_list.ReleaseBuffer();
temp1->ReleaseBuffer();
delete temp1;
this is how i generate data in ComboBox
For the ComboBox the properties are Style 1.type = "dropdown" 2.Owner draw = " no".......the dropdown list doesnot display
can u help
|
|
|
|
|
I've just udated my computer to use winxp, but I'm finding that I can't visual c++ debug to work properly with it. I used the NT upgrade util, but it says that the header wont work with xp. So, when I debug it gives error messages. This problem can't be that uncommon - does anyone know the answer? Do I need a service pack somthing?
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
I'm running VC6 SP 5 on Windows XP and debugging without a problem. What error messages are you being shown?
Michael
|
|
|
|
|
The SP5 bit might make a difference
thanks
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
hi all,
I want to pass CArray parameter to a member function.
How can i define function and how to call that...
I'm getting error "error C2955: 'CArray' : use of class template requires template argument list" on the defination line of this function
This is my defination
MyClass::MyFuynction(CArray& myArray) {
...
}
Thanks for taking time to write in.
--Sumit
modified 1-Aug-19 21:02pm.
|
|
|
|
|
I think, you need to pass MyFunction(CArray<cfoo, cfoo=""> &myarray), where CFoo is the name of the classes which the array is made of. The error message is a complaint about the fact that you havn't specified what type of array. It could be an arry of anything for all the compiler knows, and you can't just have a generic CArray - you need to specify what the array is an array of...
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
I am interested in including alert windows for an application I am writing that are similar to those that gator and msn messenger pop up (the little boxes in the bottom right of the screen). I have done some searching around on the site, I havn't found anything that does what I am looking for. It very well could be that I just don't know what to look for as I don't know what you would call that little window. If anybody could point me in the right direction I would greatly appreciate it!
Thanks,
Paul
--
Paul Tinsley
<paul@ecymtech.com>
|
|
|
|
|
I seem to have found the answer to my own question If anybody else is looking to do the same thing the answer can be found here: http://www.codeproject.com/useritems/statusbarmsgwnd.asp
--
Paul Tinsley
<paul@ecymtech.com>
|
|
|
|
|
Can anyone send me the code of check CD-ROM's door opened or closed?
Such as:
BOOL CXXXXX::CheckCDDoorOpenedOrClosed()
{
....
}
Thanks.
A VC++ beginer
|
|
|
|
|
Have a look into MSDN document
HOWTO: Getting Notification of CD-ROM Insertion or Removal
Here is the sample code from it
Sample Code
The following code demonstrates how to use the WM_DEVICECHANGE message to check for compact disc or DVD insertion or removal.
#include <windows.h>
#include <dbt.h>
char FirstDriveFromMask (ULONG unitmask); //prototype
/*----------------------------------------------------------------------
Main_OnDeviceChange (hwnd, wParam, lParam)
Description
Handles WM_DEVICECHANGE messages sent to the application's
top-level window.
----------------------------------------------------------------------*/
void Main_OnDeviceChange (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
PDEV_BROADCAST_HDR lpdb = (PDEV_BROADCAST_HDR)lParam;
char szMsg[80];
switch(wParam)
{
case DBT_DEVICEARRIVAL:
// See if a CD-ROM or DVD was inserted into a drive.
if (lpdb -> dbch_devicetype == DBT_DEVTYP_VOLUME)
{
PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb;
if (lpdbv -> dbcv_flags & DBTF_MEDIA)
{
wsprintf (szMsg, "Drive %c: arrived\n",
FirstDriveFromMask(lpdbv ->dbcv_unitmask));
MessageBox (hwnd, szMsg, "WM_DEVICECHANGE", MB_OK);
}
}
break;
case DBT_DEVICEREMOVECOMPLETE:
// See if a CD-ROM was removed from a drive.
if (lpdb -> dbch_devicetype == DBT_DEVTYP_VOLUME)
{
PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb;
if (lpdbv -> dbcv_flags & DBTF_MEDIA)
{
wsprintf (szMsg, "Drive %c: was removed\n",
FirstDriveFromMask(lpdbv ->dbcv_unitmask));
MessageBox (hwnd, szMsg, "WM_DEVICECHANGE", MB_OK);
}
}
break;
default:
/*
Other WM_DEVICECHANGE notifications get sent for other devices
or reasons; we don't care about them here. If they were
important, we would check for them and act accordingly.
*/
;
}
}
/*----------------------------------------------------------------------
FirstDriveFromMask (unitmask)
Finds the first valid drive letter from a mask of drive letters. The
mask must be in the format bit 0 = A, bit 1 = B, bit 3 = C, etc.
A valid drive letter is defined when the corresponding bit is set to
1.
Returns the drive letter that was first found.
----------------------------------------------------------------------*/
char FirstDriveFromMask (ULONG unitmask)
{
char i;
for (i = 0; i < 26; ++i)
{
if (unitmask & 0x1)
break;
unitmask = unitmask >> 1;
}
return (i + 'A');
}
Although this sample code only checks for volume arrivals due to the insertion of new media, it can be extended to get notification of other hardware events for other types too. To do so, you have to add cases for other device events and handle different device types for each event.
Happy programming!!
|
|
|
|
|
Hello i am new in using the ATL. i have a probelm my to set and get HREF of a frame.
My dll is instanted by a ASP . Now i am not able to get HREF (URL) of the page.
Please help
|
|
|
|
|
Hi,
I have a window,in which i do display a image.it works fine.But if i move the window outside the window screen( by draging )image will be erased.I do display the image though BitBlt().
Any idea?
Neha
|
|
|
|
|
Do the drawing of the image in the window in the OnEraseBackgrnd handler.
Happy programming!!
|
|
|
|
|
Still i have the same problem.
|
|
|
|
|
Try to detect when the drag is finished and and force a redraw by calling Invalidate for the window in question.
Failing that a look at your code would help.
Happy programming!!
|
|
|
|
|
Hi all, I'm kind of new at MFC and I need to make an application that would be able to graph points. I can make a dialog that does this, but now I would like to place it in an MDI architechture. How can I display dialog boxes as children of my MDI window that would be able to be viewed side by side (Replacing the Document views by my dialog)?
Thanks!
|
|
|
|
|
You can use a class of your own writing that is derived from CFormView to do this.
There are also a few classes on this site that handle graph displays that might prove helpful.
|
|
|
|
|
Hello Cpians,
I'v been working on a personal off time project and I'm at lost how to implement an idea. What I'm doing is displaying a BMP, then what I need to do is set a few regions that are hidden and will respond to the mouse events. Then displaying a set of smaller bmps the size of an icon around the screen that i can move at will and not destroy the first original bmp. Sort of layering everything . Would I use multiple CDC's(if that's possible) and treat the smaller bmps as objects? I'v looked into GDI+ and that will be my choice. Just not sure how to actually implement my idea yet. I'm new to this graphics stuff since straight text got boring for me.
Namaste
|
|
|
|
|
A CDC, or a Device Context, really only acts like a surface for you to draw on, it is not really meant for you to interact with. If what you are doing is all in the context of one window here is what I would suggest.
1. you will only use the one CDC that you receive from the client window where your display will go. All of your painting will be done on that DC.
2. All of your hidden regions could be represented by HRGN objects created with the region functions, CreateRectRgn, CreateEllipseRgn and so on, there are between 5 and 10 different ways to create regions.
3. In your window handler you can handle the WM_MOUSEMOVE and WM_LBUTTONDOWN messages to determine if the user is clicking in one of your hidden regions. To test if a certain point is in one of your regions you can use the PtInRegion function.
If you need more information or this solution will not work for you please write back.
|
|
|
|
|
kilowatt wrote:
2. All of your hidden regions could be represented by HRGN objects created with the region functions, CreateRectRgn, CreateEllipseRgn and so on, there are between 5 and 10 different ways to create regions.
Hello Kilowatt!
Does this mean when creating regions there is a HRGN object associated with each one that I can access to move or redraw the selected region?
What I need to do is create any number of regions on the fly and then some how access any one of those regions and move them or repaint them.
Thanks in advance.
|
|
|
|
|
//******************** Stocks.cpp ********************/
#include "Stocks.h"
#include <string.h>
//========================================================
int Stocks::numOfStocks = 0;
Stocks:: Stocks()
{
numOfStocks++;
}
Stocks:: ~Stocks()
{
}
void Stocks:: addStock( Stock* st, int i)
{
i = numOfStocks;
Stock& myStocks[i] = st;
}
Compiling...
Stocks.cpp
C:\My Documents\DataStru\Stocks.cpp(21) : error C2057: expected constant expression
C:\My Documents\DataStru\Stocks.cpp(21) : error C2466: cannot allocate an array of constant size 0
C:\My Documents\DataStru\Stocks.cpp(21) : error C2234: '<unknown>' : arrays of references are illegal
C:\My Documents\DataStru\Stocks.cpp(21) : error C2440: 'initializing' : cannot convert from 'class Stock *' to 'class Stock *[]'
There are no conversions to array types, although there are conversions to references or pointers to arrays
Error executing cl.exe.
Stocks.obj - 4 error(s), 0 warning(s)
can any one tell me what is wrong with this piece of code
thank you
|
|
|
|