|
David,
Sorry that you have to spoon feed me through this. I feel like such a moron because I can not grasp this concept. I really appreciate your help.
What do i have to put in DoDataExchange? Also by adding the member variable to the other cpp file, won't it over write the existing data in m_SendTo?
Thanks.
|
|
|
|
|
Jay Hova wrote:
Sorry that you have to spoon feed me through this. I feel like such a moron because I can not grasp this concept. I really appreciate your help.
Not a problem. The first few applications are always the hardest.
Jay Hova wrote:
What do i have to put in DoDataExchange? Also by adding the member variable to the other cpp file, won't it over write the existing data in m_SendTo?
I've never had to manaully add anything to DoDataExchange() . ClassWizard does it all for me (hint: use CW to create the member and control variables). By looking at that function, however, you can get a feel for what MFC might be doing.
Jay Hova wrote:
Also by adding the member variable to the other cpp file, won't it over write the existing data in m_SendTo?
I'm not quite sure I understand what you are asking here. Care to elaborate?
|
|
|
|
|
David,
Thank you for your help. I had to manually insert the control in DoDataExchange because after reading the article you linked me to earlier today, i ungrouped the second radio. It doesn't make sense to me, but it seems to be working right now.
Now to the next part of this app....
Many many thanks for your help, patience, and understanding. You are really a class act guy!
|
|
|
|
|
hi all
does ne1 know how i can convert a string into a date
i have an XML tag
<date_in>2003-08-13T09:26:24.7000000+01:00
but this brings the date back as a string,
what i need from there is the date in the format '2003-08-13'
as an actual date
does ne1 have ne ideas
thanks
si
|
|
|
|
|
it should be this
<date_in>2003-08-13T09:26:24.7000000+01:00</date_in>
|
|
|
|
|
this is what i come up with, if ne1 knows a better way pls let me know
thanks si
CString strTime2=strValue;
int val = strTime2.Find("T");
int len = strTime2.GetLength();
if (val > 0)
{
CString date = strTime2.Left(val);
CString time = strTime2.Right(len-val);
sct_dt.time = strTime2.Mid(++val,8);
CString year = date.Left(4);
CString month = date.Mid(5,2);
CString day = date.Right(2);
sct_dt.date = day+"/"+month+"/"+year;
}
|
|
|
|
|
Have you looked at COleDateTime::ParseDateTime() ?
|
|
|
|
|
Does that handle XML format dates, then? I knew it did dd/mm/yyyy or mm/dd/yyyy (based on locale). We've a local function to handle XML formatting with or without Thh:mm formats, but it doesn't yet handle offsets.
Steve S
|
|
|
|
|
Steve S wrote:
Does that handle XML format dates, then?
There's no such thing as XML format dates. XML is a way to organize data. It is not concerned with format or display.
If the first 10 characters of the string is always in the format you previously described, this should work:
CString str = "2003-08-13T09:26:24.7000000+01:00";
COleDateTime date;
date.ParseDateTime(str.Left(10));
|
|
|
|
|
Picky, picky...;)
I meant does it handle dates/times in the format commonly found in XML files, namely YYYY-MM-DD[Thh:mm:ss[.9999999[+/-hh:mm]]] (where the T may be replaced by a space), of course. This is often specified in schemas, such as GML as used by the UK's Ordnance Survey organisation. That's of particular interest to me, since I'm currently working for a company which writes GIS, mapping and location management systems.
The answer is no, in a single call, which is what I was trying to clarify, so thanks.
Steve S
|
|
|
|
|
I've tried a few different ways of using pbs_smooth for a progress control but when i do, i run into problems.
the first way i tried it is using progress_control.SendMessage(PBS_SMOOTE, x, x) but i don't know what to put in for x and x, so it crashed.
the second way i tried was by adding OnCreate() to my class, and adding
progress_control.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH, CRect(10,10,200,30), pParentWnd, 1);
I foudn that at msdn. My problem with that is where does pParentWnd come from? I dont have any classes derived from CWnd, so i don't know of anything i can put in there. CDialog does not work
:-/
*.*
cin >> knowledge;
|
|
|
|
|
there's a way to do it in the resource editor, i shoulda known.
*.*
cin >> knowledge;
|
|
|
|
|
progress_control.ModifyStyle(0, PBS_SMOOTH); keegan wrote:
where does pParentWnd come from?
The parent of the progress control, usually a pointer to your dialog. In this case, you'd probably do
progress_control.Create(WS_CHILD|WS_VISIBLE|PBS_SMOOTH, CRect(10,10,200,30), this, 1); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a button on my CFormView with a bitmap. How can I change the color of each individual pixel in the bitmap?
|
|
|
|
|
dwccgc wrote:
How can I change the color of each individual pixel in the bitmap?
Select it into a device context and use SetPixel() or SetPixelV() , the latter being the fastest.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I need to get the current color before I use SetPixel(..), but I
cannot get GetPixel() to work. pDc->GetPixel() returns -1.
Maybe I am missing something.
Note:
m_ExitButtonCtrl is of type CButton.
hbmButtonExit is of type HBITMAP.
void CMyFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
hbmButtonExit = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BUTTON_EXIT));
if (hbmButtonExit != NULL)
{
m_ExitButtonCtrl.SetBitmap(hbmButtonExit);
CDC *pDc = m_ExitButtonCtrl.GetDC();
if (pDc != NULL)
{
for (INT nX = 0; nX < 69; nX++)
{
for (INT nY = 0; nY < 47; nY++)
{
COLORREF OrgColor = pDc->GetPixel(nX, nY);
}
}
}
}
return;
}
|
|
|
|
|
You need to select the bitmap into a device context.
void CMyFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
hbmButtonExit = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BUTTON_EXIT));
if (hbmButtonExit != NULL)
{
CClientDC dc(this);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap *pBitmap = memDC.SelectObject(CBitmap::FromHandle(hbmButtonExit));
for (INT nX = 0; nX < 69; nX++)
{
for (INT nY = 0; nY < 47; nY++)
{
COLORREF OrgColor = memDC.GetPixel(nX, nY);
}
}
memDC.SelectObject(pBitmap);
m_ExitButtonCtrl.SetBitmap(hbmButtonExit);
}
}
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for the help.
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I want to user the function GetFileVersionInfo (and GetFileVersionInfoSize) in my app to get the version of a dll. My app is a MFC app. When I compile it I get an error:
unresolved external symbol _GetFileVersionInfoSize@8 referenced in function *public: __thiscall....
What is wrong? What do I have to do?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Have you linked the Version.lib library ?
|
|
|
|
|
Nope. Just did it right now and it works. Thanks!
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
It's amazing how little information on this there is out there. But any way, I'm just trying to create a standard IP port. I'm using Windows XP, I assume this code would behave the same on 2000 but haven't tried it.
I have looked at MSDN and tried to follow the documentation, but it is either incomplete or incorrect, or I'm just doing something wrong. Here is how I'm trying to create a new port.
The problem is that XcvData always fails and GetLastError returns 87 (invalid parameter.) I have no idea which parameter might be invalid, or why. I have also tried deleting a port, similarly following the documentation, and it fails as well. What's going on?
void AddMeAPort()
{
HANDLE hXcv = INVALID_HANDLE_VALUE;
PRINTER_DEFAULTS Defaults = {NULL, NULL, SERVER_ACCESS_ADMINISTER};
PORT_DATA_1 info;
::ZeroMemory(&info, sizeof(PORT_DATA_1));
DWORD error = 0;
_tcscpy(info.sztPortName, _T("MyPort"));
info.dwVersion = 1;
info.dwProtocol = PROTOCOL_RAWTCP_TYPE;
info.cbSize = sizeof(PORT_DATA_1);
_tcscpy(info.sztHostAddress, _T("some.host.name"));
_tcscpy(info.sztSNMPCommunity, _T("public"));
info.dwPortNumber = 9100;
info.dwSNMPEnabled = 1;
info.dwSNMPDevIndex = 1;
if(::OpenPrinter(_T(",XcvMonitor Standard TCP/IP Port"), &hXcv, &Defaults))
{
BYTE *hackedData = reinterpret_cast<BYTE *>(&info);
DWORD status = 0;
if(::XcvData(hXcv, L"AddPort", hackedData, sizeof(PORT_DATA_1), NULL, 0, NULL, &status))
{
} else
{
error = ::GetLastError();
}
::ClosePrinter(hXcv);
} else
{
error = ::GetLastError();
}
}
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Well, I figured it out on my own... the documentation is misleading. It says you can pass NULL to the second-to-last parameter for XcvData, but that's wrong, you need to pass in a pointer to a DWORD. Go figure.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Good people,
I’ve tried the following C++ console application sample under MS DevStudio 2003:
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
for (int index = 0; index < 3; ++index)
{
std::cout << index << std::endl;
}
std::cout << index << std::endl; // should yield a compiler error
return 0;
}
The assumption was that the commented line shouldn’t compile because it tries to access the index variable, which is out of the scope (its scope is the for loop, according to C++ standard). I need to refer to the Microsoft’s non-conformance issues on this topic, but couldn’t find one. I would much appreciate if you could provide me the link to this topic.
Thanks,
Serge
|
|
|
|
|