|
Well, you know, roughly speaking, a reference is a sugar-added-pointer, so let's write your code again, this time using the real thing (BTW no need to say that Klingon developers don't use references, references are for sissies... )
#include <string>
using namespace std;
#include <stdio.h>
void main()
{
string str1 = "a";
string str2 = "b";
string * const pstr = &str1;
printf("\ncase 0\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
str1 = "aa";
printf("\n case 1\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
(*pstr) = str2;
printf("\n case 2\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
str2 = "bb";
printf("\n case 3\n str1: %s", str1.c_str());
printf("\n str2: %s", str2.c_str());
printf("\n refstr: %s\n ", (*pstr).c_str());
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini,
Thanks a lot,
Eyal
|
|
|
|
|
I am wondering if I can use a VC6 program to remote control another windows application runing on the same XP desktop ?
ie Can a VC6 program send messages to another windows application to perform actions on it that the user would normaly do with the keyboard and mouse. Essential the analogy is that of pipeing input into a command line program from another source, eg a file.
Perhaps there is a windows application that will already do this without me needing to write one ?
Neil
|
|
|
|
|
Yes, this can be done. You can write your own or look into automated testing frameworks that do this kind of thing. They usually allow you to write a test script that specifies all mouse and keyboard actions that are sent to the target window.
|
|
|
|
|
hi,
I am using visual studio 2008, I wrote a dialog based application, now I want add skins to my dialog. Please give me the approach or give me links related to this issue.
Thanks in advance...
sampath-padamatinti
|
|
|
|
|
http://chimedu1.wikispaces.com/file/view/task.pdf/
|
|
|
|
|
sampath-padamatinti wrote: I want add skins to my dialog.
Take a look at this site[^], it contains some excellent information.
|
|
|
|
|
You can send mail to me,that I will send the DEMO to you.
koma0769@vip.qq.com
More Skin,you can open this url to find:
http://www.appface.com
|
|
|
|
|
If you're using VS 2008, you could download and install the MFC Feature pack for Visual C++ 2008[^]. The MFC library has been enhanced to support feature rich UI with office ribbon control, and other funky stuff. I've not used that much, but there are some sample projects that can be downloaded from MSDN.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
The file format is defined as followed:
• Every line contains one point
• The point definition contains x, y and z coordinates delimited by a space character
• Each line is ended by the new line character
Please note that only “visible” points from top view must be written to the file (the skin of the point cloud from top view) (Illustration 4).
Given:
1. Point class for the definition of a point in 3d and (some) methods for vector algebra
2. Strictly use of STL and C++ stream library
3. Visual C++ 6.0 or .NET as a development environment
4. High level test function to test the resulting component. This defines also the “interface” of the component to be written.
Hints:
- Create a small documentation 1 page with 2 pictures to present the mathematical approach of the sphere move point intersection. It should clearly communicate the mathematical approach and how the “mathematical” code is generated from that
- Use of vector algebra (dot product, cross product etc.) is highly recommended. The use of sin and cos functions is not desired.
Calculation speed is important but secondary in comparison to a good object oriented approach. E.g. a sphere, linear move of a sphere, point writer etc. should be modeled as classes. Try to use many of compact classes instead of large classes and large functions.
- Comments in the source code are welcomed. Please use “good” names for classes and functions.
- Move of a sphere between f (t) and f (t Δt) can be assumed as a linear move of the center of the sphere.
|
|
|
|
|
Is this a question or a request for someone to write your program for you? If the latter than you are in the wong place; try RentaCoder[^].
|
|
|
|
|
I have an idle time monitoring class that works great but it will not process any messages when the application is minimized....Any ideas on how to monitore idle time on minnized apps?
Daniel
|
|
|
|
|
Hi Daniel,
You can have your hook procedure in a hidden window that is not in the minimized state. However... why can't you just call the GetLastInputInfo Function[^] to determine the users idle time?
Best Wishes,
-David Delaune
|
|
|
|
|
Use Win32 Shell Idle apis instead
|
|
|
|
|
kilt wrote: Use Win32 Shell Idle apis instead
And which Win32 Shell function would that be?
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
I'd like to how caputre scrollview area, incluing unvisible area...
scrollview size is nomally big than actually monito's resoluton, unvisible area don't captured...
CRect rect;
HWND hWnd = m_hWnd;
if (hWnd == NULL) return;
HDC hScrollView = ::GetWindowDC(hWnd);
HDC hCaptureDC = CreateCompatibleDC(hScrollView);
CRect m_rDrawingSurface;
::GetWindowRect(hWnd,&m_rDrawingSurface);
BITMAPINFOHEADER BMIH;
HBITMAP m_hCaptureBitmap;
BYTE* m_pDrawingSurfaceBits;
CDC* pDC = GetDC();
if(pDC != NULL)
{
BMIH.biSize = sizeof(BITMAPINFOHEADER);
BMIH.biBitCount = 24;
BMIH.biPlanes = 1;
BMIH.biCompression = BI_RGB;
BMIH.biWidth = m_rDrawingSurface.Width();
BMIH.biHeight = m_rDrawingSurface.Height();
BMIH.biSizeImage = ((((BMIH.biWidth * BMIH.biBitCount) + 31) & ~31) >> 3) * BMIH.biHeight;
m_hCaptureBitmap = CreateDIBSection(pDC->GetSafeHdc(), (CONST BITMAPINFO*)&BMIH, DIB_RGB_COLORS, (void**)&m_pDrawingSurfaceBits, NULL, 0);
ReleaseDC(pDC);
}
SelectObject(hCaptureDC,m_hCaptureBitmap);
BitBlt(hCaptureDC,
0,
0,
m_rDrawingSurface.Width(),
m_rDrawingSurface.Height(),
hScrollView,0, 0,SRCCOPY|CAPTUREBLT);
CxImage *image = new CxImage();
if(m_hCaptureBitmap)
{
image->CreateFromHBITMAP(m_hCaptureBitmap);
bool retval;
retval = image->Save("c:\\ss.bmp", CXIMAGE_FORMAT_JPG);
}
if (image) delete image;
::ReleaseDC(hWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(m_hCaptureBitmap); :)
|
|
|
|
|
I am going to implement smart card using VC++.
i am using SCM dual interface reader SDI010
having standards ISO7816 And ISO14443 (type A and B).
Can someone tell about some sample code that can provide me help that how can i read from and write into a smart card..
Thanks in advance
|
|
|
|
|
There are some smartcard samples located in the Windows Driver Kit[^]. They are located at \7600.16385.0\src\smartcrd in the install path.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi all,
i m using a picture control to browsing picture,i have also a option to remove this picture from picture control by clicking the remove button.
but when i click remove button to remove the picture ,its not refresh ,if i move the propertysheet and than its refresh.
please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Maybe a call to UpdateWindow() is in order.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I think that you can Invalidate the control.
|
|
|
|
|
How to restrict a class not to create more than 3 objects?
|
|
|
|
|
Handle the construction yourself - make the constructor private and provide a public static method to create an instance of the class. Keep a data member to maintain the count of currently active objects, which should be a maximum of 3. Increase it with every construction and decrease it in the destructor.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
You could try this, although it's NOT thread-safe
class Restricted
{
public:
Restricted()
{
if (instances==3) throw SomeException();
instances++;
}
~Restricted()
{
instances--;
}
private:
static int instances;
};
int Restricted::instances = 0;
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The (overabused... ) Singleton design pattern [^] can easily modifed to fulfill such a requirement.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|