|
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
|
|
|
|
|
It's quite simple, actually. IF you go under your project's "Properties" tab, there is a setting about this issue.
Go to the C/C++ tree folder, and in it, the Language item.
There is an item in the right called "Force conformance in For Loop Scope". You can turn it on, in which case the above code you had will fail to compile, or leave it off, in which the code will compile. For whatever reason, it is set to "no" by default, perhaps for compatibility with older code?
But that's what you want.
I hope that answers your question...
"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
|
|
|
|
|
Thanks !!!
So, can I assume that there is no _official_ non-conformance issue on this topic?
Thanks,
Serge
|
|
|
|
|
Yes, there are official documents that talk about conformance issues. I don't know how in depth they might be.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim,
I need a link to that document.
Thanks,
Serge
|
|
|
|
|
i want a function to do the following .
open a text file ..
check for a string given as input parameter to the function whether it is available in the text file .
return the string after = sign in the text file .
for example the text file may contain data as below
proj1=customer
proj2=report
proj3=client
if i call the function passing proj2 as parameter then it should return report and if pro4 is sent as parameter it should return failed/not found.
thanx in advance
|
|
|
|
|
My solution (which is not the only nor effecient one) would be make a CStdioFile, open the file, use the ReadString to put a line in a var (strLine). Take out the first x amount of characters (x being the Len(parameter)). Compare that var with the parameter, if equal then use strLine.Right(len(strLine) - (len(parameter) + 1)) to return your 'report', 'client', etc.
if don't find any, when reach EOF, just display 'failed/not found'.
ja
|
|
|
|
|
Sounds like you are looking for a setup file.
There are heaps of articles on CodeProject to do this. You could possibly try something like IOBind.
If you have to do it your way you could try (in no particular order)
1/ boost::spirit, which is a metatemplate parser
2/ lex or flex, which are parsers
3/ use something like Lua, which is a scripting language which lets you get / set variables from a script
4/ use an XML parser (assuming you really do want a setup file) - maybe tinyXML
5/ use raw STL, iostreams, strings and string::find()'s
6/ use STL with boost::regex
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
or you could do it a simple way unless i'm missing some huge thing...
- input the string from the text file
- check to see if the first character of the string is NULL
- check to see if any of the characters in the string are '='
- if the above is true, put every character after the = sign inside a new string
- do what you need to do with that new string
*.*
cin >> knowledge;
|
|
|
|
|
CString strSearch = "proj1";
CString strLine;
CString strValue;
CStdioFile file;
while (file.ReadString(strLine) == TRUE)
{
if (strLine.Find(strSearch + '=') != -1)
{
strValue = strLine.Mid(strLine.Find('=') + 1);
break;
}
}
|
|
|
|
|