|
My fault. I was assuming that it would return date and time stored in the system.
|
|
|
|
|
Is there a way to assign a version number to any type of file?
INI, DOC ... TXT.
thank you
|
|
|
|
|
If the file is part of some 'version control' system, then you likely can do what you are after. But the short answer is no, I think.
Chris Meech
It's much easier to get rich telling people what they want to hear. Chistopher Duncan
But for a man, barbecuing eggplant and portobello mushrooms is a sure way to have people question your sexual orientation. Kuro5hin
|
|
|
|
|
Yes. Within Windows Explorer, right-click the file and select Properties. Click the Summary tab. Enter a version number in the Revision Number box. This number, and the other pieces of information, are stored in the file itself. This is called structured storage.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
how to search post in the forum?
i.e. i need info about "CRichEdit", but i only get "aticles", not posts.
how to do the search, or where is the search engine?
thanks
includeh10
|
|
|
|
|
|
thx, it is what i'm looking for
includeh10
|
|
|
|
|
Hi there'
how can I add buttons to dialog titlebar? I want to create my own buttons aside to min/max.
thanks
Yaniv
|
|
|
|
|
You have to simulate the button yourself. You cannot add a button to the non-client area. You will need to draw the button yourself, and also handle the WM_NCLBUTTONDOWN and other messages to simulate the button corretly. Its a real pain from what I hear (never done it myself).
Sounds like a good idea for an article.... I may go and work out how to do it. If I get time, or you could post a solution yourself if get one that works.
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
Hello, I am a novice C++ programmer, I wrote a OCX control for use in Visual Basic using MFC. The problem is I want to extend the number of parameters that I pass to the methods by using a object instead of "simple" strings and integers. I also want my events to pass this object back.
Currently mode method is called from VB like
Height = 44
Width = 33
Call MyOCXControl.DrawRect( Height, Width )
I want to change this to (this is the Visual basic part)
Set Myobject = New ComObject.Container
MyObject.Height = 44
MyObject.Width = 32
MyObject.Title = "Hello world"
Call MyOCXControl.DrawRect(MyObject)
As you can see, I need to know how to create a "MyObject" in C++ and have Visual Basic understand it's interface. As well I need to let my existing OCX (MyOCXControl) allow this MyObject to passd to it.
I see lots of example of writing a OCX but none that explain how to do this. Source code illistrating this would be awsome.
Thanks in advance.
|
|
|
|
|
My experience with this sort of thing is a little rusty now, but should have enough information get you started.
You need to understand a little more about how COM (Component Object Model) works, but it should be relatively straightforward from that point.
ActiveX controls (your OCX) are based on COM as well, so what you need to do is write your "MyObject" as another COM object using MFC or ATL. Then you can pass the object from VB into your control.
The function you write on the C++ side of your ActiveX control I think should take a pointer to IUnknown or IDispatch. Once you have this pointer, you can QueryInterface for your own interface (or call Invoke() if it's IDispatch), and pull the height and width, etc values from there.
I'm sure some COM gurus can fill in/correct anything important I've missed.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
I have a MS Visual Studio .NET 2003 C++ MFC CFormView class GUI which has a Picture Control in the dialog. I need to load .bmp, .jpg, or .tiff into the picture control, so I’m using GDI+. I got it to load the picture, center it, and stretch it into the control. I could then pick and load a 2nd one if desired which would overwrite the first. It all seemed good, but if it had to repaint the window it would crash (this included minimize/maximize the child or main window or anything blocked part or all of the image then moved).
I found a problem where the image resizing could cause the image to be slightly larger than the picture control rectangle. I fixed that, and the crashes stopped. However, the image would just disappear (if any of the things listed above happened). I would have to re-choose the image.
After doing some other things I’m back to the crashes. I can’t figure out what’s going on. Here’s the errors:
Microsoft Development Environment pop-up error message:
Unhandled exception at 0x00000003 in NodeGUI.exe: 0xC0000005: Access violation reading location 0x00000003.
It shows the gdiplusgraphics.h file with a green arrow pointed at the (next to last) height line below:
Status DrawImage(IN Image* image,
IN INT x,
IN INT y,
IN INT width,
IN INT height) {
return SetStatus(DllExports::GdipDrawImageRectI(nativeGraphics,
image ? image->nativeImage
: NULL,
x,
y,
width,
height));
}
The output file also shows the following:
The thread 'Win32 Thread' (0x748) has exited with code 128 (0x80).
The thread 'Win32 Thread' (0x4e0) has exited with code 128 (0x80).
The thread 'Win32 Thread' (0x62c) has exited with code 128 (0x80).
The thread 'Win32 Thread' (0x728) has exited with code 128 (0x80).
The thread 'Win32 Thread' (0x600) has exited with code 128 (0x80).
The program '[1252] NodeGUI.exe: Native' has exited with code 128 (0x80).
Here’s the relevant code I’m using:
void CNodeGUIView::OnPaint(){
CPaintDC dc(this); // device context for painting
//m_st1 is the static picture control
//defined by DDX_Control(pDX, IDC_MapImage, m_st1);
CDC* map = m_st1.GetDC();
Graphics mapGraphics(map->m_hDC);
//imgX is the image width, imgY the image height,
//centerX & centerY are the coordinates of the
//top left corner where the image should be
//placed in the static picture control
imgX = 1; imgY = 1;
centerX = 0; centerY = 0;
//the PictureManip class correctly sizes and places
//the image
//it returns (by reference) the proper coordinates
PictureManip::ChangePicSize(picCtrlWidth,
picCtrlHeight, imageWidth, imageHeight, imgX,
imgY, centerX, centerY);
//mapPtr is the Image* to the image file
mapGraphics.DrawImage(mapPtr, centerX, centerY, imgX,
imgY);
mapGraphics.ReleaseHDC(map->m_hDC);
map = NULL;}
I’ve commented out the last two lines (to not release anything) with no change. Is there a validation/invalidation I need to do?
As far as GDI+ goes, I’ve got:
CMainFrame::CMainFrame(){
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);}
CMainFrame::~CMainFrame(){
Gdiplus::GdiplusShutdown(m_gdiplusToken);}
in MainFrm.cpp. In the MainFrm.h public attributes:
ULONG_PTR m_gdiplusToken;
Should anything be somewhere else? The
#include <gdiplus.h>
is in the stdafx.h file.
Also, if I draw a rectangle over the image with a brush, how would I then erase the rectangle while redrawing/maintaining the background image (which currently crashes as stated above)?
Thanks
|
|
|
|
|
I am new to attribute programming with .NET and I am having an issue with the db_param attribute.
Here is the class definition:
[
db_source(L"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist .....")
db_command(L" \
SELECT \
Color, \
Celsius, \
AcousticVisc, \
DisplayUnits, \
DiplayValue, \
DataSequence \
FROM dbo.ViscData \
WHERE (Customer = '?') \
AND (JobID = '?') \
AND (RunID = '?')")
]
class CViscGridData
{
public:
[ db_column(1, status=m_dwColorStatus, length=m_dwColorLength) ] TCHAR m_Color[51];
[ db_column(2, status=m_dwCelsiusStatus, length=m_dwCelsiusLength) ] double m_Celsius;
[ db_column(3, status=m_dwAcousticViscStatus, length=m_dwAcousticViscLength) ] double m_AcousticVisc;
[ db_column(4, status=m_dwDisplayUnitsStatus, length=m_dwDisplayUnitsLength) ] TCHAR m_DisplayUnits[21];
[ db_column(5, status=m_dwDiplayValueStatus, length=m_dwDiplayValueLength) ] double m_DiplayValue;
[ db_column(6, status=m_dwDataSequenceStatus, length=m_dwDataSequenceLength) ] SHORT m_DataSequence;
[ db_param(1, DBPARAMIO_INPUT, status=m_dwCustomerStatus, length=m_dwCustomerLength) ] char m_Customer[50];
[ db_param(2, DBPARAMIO_INPUT, status=m_dwJobIDStatus, length=m_dwJobIDLength) ] char m_JobID[50];
[ db_param(3, DBPARAMIO_INPUT, status=m_dwRunIDStatus, length=m_dwRunIDLength) ] char m_RunID[50];
.....}
I am testing this in the following manner:
...
sprintf(gd.m_Customer,"North Face");
sprintf(gd.m_JobID,"Spring Collection");
sprintf(gd.m_RunID,"1000");
HRESULT hr = gd.OpenAll();
if(SUCCEEDED(hr))
{
hr = gd.MoveNext();
while(SUCCEEDED(hr) && hr != DB_S_ENDOFROWSET)
{ ....}
}
The problem is my MoveNext always returns a DB_S_ENDOFROWSET. However if I hardcode the db_command with the same values I get the data I am expecting.
I have no idea what I have done wrong. Any suggestions?????
Thanks,
TheMooseMan
|
|
|
|
|
Hi all,
i want to snapshot the registry in a certain time, then snapshot it again and and other time then compare.
any1 can suggest usefull method?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Short of writing your own code (using RegEnumKey() and RegEnumValue() ), check out the utilities here at CP, and the one here.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanks
|
|
|
|
|
Does anybody know how to determine what caused WM_QUERYENDSESSION Windows session end message sent:
- system shutdown request;
- system reboot;
- system power off;
- reboot in MS DOS (on Win9X)?
It seems, WM_QUERYENDSESSION has only one parameter, which allows to determine the case of the user log-off. Any way to get more information?
Thanks,
Viktor
|
|
|
|
|
Hi all,
I have a class CMyBtn inherites from CButton. i want to draw it myself....
I have 4 bitmaps for each state - normal/down/over/disabled
I've tried to place code in OnPaint as follows:
void CMyBtn::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetWindowRect(rect);
BITMAP bmp;
HBITMAP hBitmap = NULL;
memset(&bmp,0,sizeof(bmp));
switch (m_eBtnState)
{
case bsUndefined:
ASSERT(FALSE);
return;
case bsNormal:
hBitmap = (HBITMAP)m_bmpNormal.m_hObject;
break;
case bsDown:
hBitmap = (HBITMAP)m_bmpDown.m_hObject;
break;
case bsOver:
hBitmap = (HBITMAP)m_bmpOver.m_hObject;
break;
case bsDisabled:
hBitmap = (HBITMAP)m_bmpDisabled.m_hObject;
break;
default:
ASSERT(FALSE);
return ;
}
::GetObject(hBitmap,sizeof(bmp),&bmp);
HDC compatibleDC = CreateCompatibleDC(dc.m_hDC);
HBITMAP hSavedObj = (HBITMAP)::SelectObject(compatibleDC,hBitmap);
ASSERT(NULL != m_pParentDlg);
COLORREF transparentColor = m_pParentDlg->GetDialogTitleBKColor();
ScreenToClient(rect);
BOOL bRes = TransparentBlt(dc.m_hDC,
rect.left,
rect.top,
rect.right,
rect.bottom,
compatibleDC,
0,
0,
bmp.bmWidth,
bmp.bmHeight,
transparentColor);
::SelectObject(compatibleDC,hSavedObj);
::DeleteDC(compatibleDC);
}
the button picture of the bitmap is round button. when i looked at the button on the dialog i saw the round button but with gray frame (the part that was outside the button) that made me believe it was a problem of erasing the backgroun so i've added the following code:
BOOL CMyBtn::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
now i saw the button really good.
problem is when i move the mouse or click it i don't see the pictures changing as they i want them to.....
what should i do?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
Thanks for the reply....
i've already managed without the buttonst help
thanks again
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi !
I am ran into a great problem I can not solve.
How can we set IP over two modems that are connected togheter ?
A BIG thanks in advance.
|
|
|
|
|
find it out yourself or ask more special questions about it!
Don't try it, just do it!
|
|
|
|
|
Hello, everyone!
When using the following program to check in/out band width of a network adapter, the band width is always zero. Anyone know how to resolve the trouble?
Source Code:
----------
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <pdh.h>
#include "iphlpapi.h"
#include "Iptypes.h"
#include "Iprtrmib.h"
#pragma comment(lib,"iphlpapi.lib")
int main (int argc, char** argv)
{
unsigned long pOutBufLen = sizeof (IP_ADAPTER_INFO);
IP_ADAPTER_INFO AdapterInfo;
memset (&AdapterInfo, 0, sizeof (IP_ADAPTER_INFO));
MIB_IFROW ifrow;
DWORD last_sent, last_recv, current_sent, current_recv;
DWORD diftime, dlwinspeed, upwinspeed, dw_refreshtime;
if( GetAdaptersInfo(&AdapterInfo, &pOutBufLen) != ERROR_SUCCESS ){
printf("Could not open default interface!");
return ( 0 );
}
ifrow.dwIndex = AdapterInfo.Index;
if( GetIfEntry( &ifrow ) != NO_ERROR ) {
printf("Could not open default interface!");
return ( 0 );
}
while (1)
{
current_sent = ifrow.dwOutOctets - last_sent;
current_recv = ifrow.dwInOctets - last_recv;
last_sent = ifrow.dwOutOctets;
last_recv = ifrow.dwInOctets;
printf ("Octs out: %ld\n", ifrow.dwOutOctets);
printf ("Octs in: %ld\n", ifrow.dwInOctets);
diftime=(GetTickCount()-dw_refreshtime);
dlwinspeed = current_recv/diftime;
upwinspeed = current_sent/diftime;
dw_refreshtime=GetTickCount();
printf ("Band in: %ld\n", dlwinspeed);
printf ("Band out: %ld\n", upwinspeed);
Sleep (5000);
}
return 0;
}
----------
Thanks in advance,
Geo
|
|
|
|
|
When I compile my .exe the compiler give me this error:
"error LNK2020: unresolved token (0A0000FD) SysStringByteLen"
"error LNK2020: unresolved token (0A000101) SysAllocStringByteLen"
This problem occur when I set the proprety project "Treat wchar_t as Built-in Type" (in th C/C++\Language Menu) to "No". My project use Managed Extensions and C# class.
I try (how is described in MSDN) to include "oleauto.h" and to link oleaut32.lib, but it was all in vain.
Thank you very much for any answer.
|
|
|
|
|