|
Thank you Mr Anonymous, this works brilliant.
We have to change lots of dialog classes, is there a place, perhaps at the app level, we could create the solidbrush & it would work for all dialogs....
Currently, we are creating the brushes in each class, this works.
Again, Thanks.....
Gerry.
|
|
|
|
|
I'm desiging this program in C/C++ with my friend. We are just testing a concept we would like to get to work. All I want to happen... is the program connect to a website and find out if a file exists or not. If it does then it opens it. If not then it says it doesn't exist. One other thing, no mfc!! Is there any "simple" way to do this without have millions of classes and libraries designed to work with web browsers included in the program? Any help on this would be great, because we are relly stuck on this one.
|
|
|
|
|
Yes it can be done. You need to create a simple HTTP class that connects to a server and sends a GET request. The server will send back a standard HTTP response which you can parse to determine if the file exists or not. You will need to use winsock for the networking stuff.
There's a simple program called wget that does just that. I believe the source code is available.
|
|
|
|
|
Take a look at the "internet" functions like InternetConnect()
They don't use MFC, they uses Wininet, and works great
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Use this functions.
::InternetOpen();
::InternetConnect();
::FtpFindFirstFile();
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Hi,
I have a Listview where i have some 5 columns.In the first two columns i am supposed to put some bitmaps and again the bitmaps should be transparent.
I am not facing any problem in doing this.But when i select a particular row the bitmaps which are sitting there in the ListView columns are not looking transparent even though i mask it with the background color of the bitmap.The background of the bitmap takes the back color of the ListView window.
Could u please help me solving this problem.
Waiting for ur response.
Manohar Mishra
Digital India.Bangalore
|
|
|
|
|
What about some code?
|
|
|
|
|
Hi,
thanx for the quick reply.I am sending some portion of the code.
Here CTest1View is derived from CListView.The bitmap is a small red cicle , and the background is white.
Here is the code for the PreCreateWindow method
BOOL CTest1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style |= (LVS_SHOWSELALWAYS | LVS_REPORT );
return CListView::PreCreateWindow(cs);
}
Here is the code for the OnCreate method.
int CTest1View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CListView::OnCreate(lpCreateStruct) == -1)
return -1;
CListCtrl &lc = GetListCtrl();
LVCOLUMN lvCol;
LVITEM lvItem;
int n, x;
DWORD dwOldBits;
dwOldBits = lc.GetExtendedStyle();
dwOldBits |= LVS_EX_FULLROWSELECT;
dwOldBits |= LVS_EX_SUBITEMIMAGES | LVS_TYPEMASK;
dwOldBits |= LVS_EX_HEADERDRAGDROP |LVS_NOSCROLL;
// images in the subitems
lc.SetExtendedStyle(dwOldBits);
COLORREF crBkColor = ::GetSysColor(COLOR_WINDOW);
m_pDocImgLst = new CImageList();
BOOL bCreate = m_pDocImgLst->Create(22, 14, ILC_MASK, 2, 0);
CBitmap bmp;
int nImgIndx = -1;
bmp.LoadBitmap(IDB_BITMAP1);
n=m_pDocImgLst->Add(&bmp,RGB(255,255,255));
bmp.DeleteObject();
lc.SetImageList(m_pDocImgLst,LVSIL_SMALL);
for (int i = 0; i < 3; i++)
{
lvCol.mask = LVCF_IMAGE | LVCF_WIDTH|LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT;
lvCol.fmt = LVCFMT_BITMAP_ON_RIGHT;
lvCol.cx = 50;
lvCol.pszText = "aaa";
lvCol.iImage = 0;
lvCol.iOrder = 2;
int er = lc.InsertColumn(i,&lvCol);
}
for(int k=0;k<10;k++)
{
lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
lvItem.iItem = k;
lvItem.iSubItem = 0;
lvItem.cchTextMax = 50;
lvItem.iImage = 0;
lvItem.pszText = "Manohar";
lc.InsertItem(&lvItem);
}
LVITEM lvItem1;
for(int j=0;j<10;j++)
{
lvItem1.mask = LVIF_IMAGE |LVIF_TEXT;
lvItem1.iItem = j;
lvItem1.iSubItem = 1;
lvItem1.pszText = "ZZZZ";
lvItem1.iImage = 0;
lvItem1.state = 2;
lvItem1.stateMask = 2;
lc.SetItem(&lvItem1);
}
// TODO: Add your specialized creation code here
return 0;
}
Please let me know if this is not enough.....
Thanx again.......
Waiting for ur reply
|
|
|
|
|
Well, I'm not an expert of image lists, but did you try to create the image list from the bitmap directly?
Something like:
BOOL bCreate = m_pDocImgLst->Create(IDB_BITMAP1, 22, 0, RGB(255,255,255));
Paolo.
|
|
|
|
|
I would like to know if i could have in a function a parameter which is an Access Table.
In fact, i want to have a global function which could adapt itself for each case. For example,
for one case i want to open table1, in second table2... Each table have the same form,
they have the same number of rows and columns!!! So is it possible to create one function only?
thank in advance
gerald
|
|
|
|
|
I'm not sure of the access table parameter, but I would create a function that took the name of the table in question and performed a query then I could use the recordset as needed.
void QueryTable(std::string Table)
{
"SELECT * FROM " + Table;
use recordset
}
|
|
|
|
|
Hi,
Is it possible to have a string constant in VC, span over multiple lines?
Cheers
Rich
|
|
|
|
|
you mean:
const std::string MyStr = "Hello"
"World";
???
(that will create the string "HelloWorld".)
|
|
|
|
|
Thats What I meant! Just dealing with long SQL strings
|
|
|
|
|
I NEED TO ENTER ANOTHER BACKSLASH INTO A STRING TO GET A PROPER C DIRECTORY STRUCTURE.
//src /////////holds the directory path ex "c:\testdata"
////////////////what i neet to do is change the string to "c:\\testdata"
//cmpstr ////////////holds char(92) ascii code for \
for (int fndi=0;fndi< src.GetLength();fndi++){
wsprintf(orgstr,"%s",(LPCTSTR)src.GetAt(fndi));
if(strcmp(orgstr,cmpstr) == 0){
src.SetAt(fndi,'\\');
fndi++;\\\\\\\\\\\\\\\skip so that i do not find the "\" i just added
}
}
the main problem that i am having is that a single backslash is found a an end of line and can not be compared properly.
|
|
|
|
|
Check PathRemoveBackslash that may help you
|
|
|
|
|
pathremovebackslash removes the last backslash from the string.
I need to change a string from "c:\testdata" to "c:\\testdata"
|
|
|
|
|
Do you need to do this, or do you just _think_ you need to do this?
Remember, the string as it exists in memory is
c:\testdata.
In oprder to represent this in a C string in your code, you need
"c:\\testdata"
So the string does not really have two backslashes - it just looks like it does.
|
|
|
|
|
if i type in "c:\\testdata" my function works
if i pass it "c:\testdata" it does not work
|
|
|
|
|
You are confusing your source code with what is actually in memory.
\\ tells the *COMPILER* that you really want to use a single backslash. When the compiler sees two \\'s, it converts them to a single backslash in the actual code, just like \n is converted to a newline character in the actual code.
It will do not good to have a function which converts this, because when you type "C:\testdata" the compiler actually sees "C:<tab>estdata" (because the compiler converts a \t to a tab character).
Don't confuse compile-time substitutions with what is the compiled output.
|
|
|
|
|
Hi,
I would like to write a time (hh:mm:ss.ff) in a editbox.
I would like to enter only hh, mm, ss, ff.
Best regards
youssef
|
|
|
|
|
What you need is a masked edit control. There are some examples here and on other sites.
|
|
|
|
|
I'm having some trouble with screen flickering when the browser window (or active X test control container) is scrolled.
It is really quiet bad, Is ther any way to get better redrawing? with less flickering? I've tried some double buffering but it doesn't seem to work. Especially with the CDC that the OnDraw function gives me.
It is an MFC base Active X control.
Any ideas, would be great
thanks,
JAred.
|
|
|
|
|
try overriding the WM_ERASEBKGND. It might help.. If the control is in the whole window
|
|
|
|
|
Hi, thanks for the reply, But I've already done that, and it doesn't seem to make much of an improvement with or without it.
The main flickering occures when the container window (IE) is scrolled or resized.
I'm not sure what else to do, or if this is a common problem.
Jared
|
|
|
|