|
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
|
|
|
|
|
Marwan wrote:
Stock& myStocks[i] = st;
You're assigning to an element of the array, right? Take out the Stock& because you're not declaring a new variable.
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
void Stocks:: addStock( Stock* st, int i)
{
i = numOfStocks;
Stock& myStocks[i] = st;
}
You reassign a value from an input parameter?
|
|
|
|
|
I've got a file browsing list control inside a custom Outlook Control. The problem is that when I remove all the items in the list control and fill them with a new list (as in the user selects a different folder to browse), a bunch of blank space gets left at the top. Below is a screenshot:
(dunno why this image doesn't want to display)
This seems about the same amount of space as the scroll offset before the list items were updated. I've tried a calling a bunch of functions to see if I can get rid of this, but can't. (The attemps are shown below under the //!!! part.
void
cPkpPhotoListControl::OnRightClick(NMHDR* pNMHDR, LRESULT* pResult)
{
cResId PopupMenuResId = GetPopupMenuResId();
//!!!
CListCtrl::SetWorkAreas(0, NULL);
CListCtrl::Arrange(LVA_ALIGNTOP | LVA_ALIGNLEFT);
CListCtrl::SetWorkAreas(0, NULL);
SetScrollPos(SB_VERT, 0);
if(!PopupMenuResId.IsVoid())
{
cPoint ScreenPoint;
GetCursorPos(&ScreenPoint);
//!!!!
cPoint sss = ScreenPoint;
ScreenToClient(&sss);
cWindowHelper Helper(this);
Helper.HandlePopupMenu(PopupMenuResId, ScreenPoint);
}
*pResult = 0;
}
Now I've hooked this into the right mouse click handler so I they are called whenever I hit the right mouse button (just for debugging).
I've also tried clicking the top of this space, and that point comes out as near 0 in client coordinates, so I know that white space is part of the list control. I can also drag a selection box in this white space.
Anyone have any ideas? Any other commands I can try?
Cheers,
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Such a thing as a class prototype? Im sure there is... I need to know how to use it since I have a class that needs to derive an object from another class and use it but the other class is defined after it and if i define it before it I will hit the same problem with its class.
-- Remember your are but a lowly hair on my s*r*t*m
|
|
|
|
|
For example, the class prototype for CString would be:
class CString;
But you can only use pointers and references to a prototyped class if it's not defined yet (just declared with the prototype). So you'll have to create instances of it off the heap with the new operator, and store data members as pointers.
cheers,
swinefeaster
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
And make sure you don't use the old C casting operation on pointers prior to the class being defined. That will cause nasty problems. If you use static_cast, it will error if the class hasn't been defined.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
new CString;
my_val = CString.whatever(); ?
-- Remember your are but a lowly hair on my s*r*t*m
|
|
|
|