|
thanks!
what I am trying to do is to move an existing document/view architecture MFC app into a form whereby it could be placed on an IE browser and do the same stuff...essentially, I have an existing MFC exe and I want to create an ActiveX out of it so it could be embedded into an html page and do the same stuff?
thanks
|
|
|
|
|
Hi, I am trying to display a bitmap in a SDI applicationg and for some reason it wont display the bitmap. Here is the code I am using. Any suggestions would be greatly appreciated.
CStatic myStatic;
myStatic.Create(_T("My Static"),
WS_CHILD|WS_VISIBLE|SS_BITMAP,
CRect(10,10,100+505,100+435),
this);
myStatic.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP1)) );
Thanks for the help.
|
|
|
|
|
hInstance parameter (first one) from LoadBitmap should
be the instance of the module that contains the bitmap . In your case your application. You can use it as NULL only for predefined bitmaps like OBM_CLOSE.
Regrads,
/REMUS
|
|
|
|
|
Hi!
When I have built my program and executes the exec file my program looks for a database file I have connected to my program. The problem here is that the path to the file is hard coded so it looks for it in a certain location on the HD. What I want to do is charnge where it looks for the database. But I don't know how to get a string of the executive file. Is there any function that can get the execution path of this file?
I have found in the database file where it returns this path. I want to change it so that it gets the location where the .exe file is run.
Thank you for reading, (or even more importantly responding!
|
|
|
|
|
Here's three functions I use for getting the program path.
JustPath() - extracts the path from a string containing a filename.
AddBackSlash() - adds a backslash to the end of a string if it's needed.
GetProgramPath() gets the path and module filename of the running program (calls JustPath and AddBackSlash).
//------------------------------------------------------------------------------
Returns just the path if present of the specified filename string.
//------------------------------------------------------------------------------
CString JustPath(LPCSTR f)
{
char drive[_MAX_DRIVE],
dir[_MAX_DIR],
file[_MAX_FNAME],
ext[_MAX_EXT];
CString st;
_splitpath((char *)f, drive, dir, file, ext);
st = drive;
st += dir;
return st;
}
//----------------------------------------------------------------------------/
// Add a back slash to the end of the path if it doesn't exist.
//----------------------------------------------------------------------------/
void AddBackSlash(CString& path)
{
int length = path.GetLength();
if (length > 1)
{
if (path.GetAt(length - 1) != '\\')
{
path += "\\";
}
}
else if (1 == length)
{
CString temp = path;
temp.MakeUpper();
TCHAR ch = temp.GetAt(0);
if (ch >= 'A' && ch <= 'Z')
{
path += ":\\";
}
else if (ch != '\\') // add a back slash anyway
{
path += "\\";
}
}
else
{
path += "\\";
}
}
//-----------------------------------------------------------------------------/
// Get the path were the program was run from
//-----------------------------------------------------------------------------/
CString GetProgramPath(BOOL bStripFileName/*=TRUE*/)
{
CString sPath;
TCHAR szFullPath[MAX_PATH];
::GetModuleFileName(NULL, szFullPath, MAX_PATH);
if (bStripFileName)
{
sPath = JustPath(szFullPath);
AddBackSlash(sPath);
}
return sPath;
}
|
|
|
|
|
|
I am a jackeroo in WinCE and need you help very imminently!
my develop environment:
vc6.0 + WinCE toolkit for VC6.0
the configuration in my project
"H/PC Ver.2.00"
my target device:
cpu: MIPS
os: WinCE 2.11
Is there some problem in compatibility and what should I do?
Thanks a lot!
|
|
|
|
|
Are there any methods to implement a drag source on an application if it is not previously implemented? e.g. If IE does not support dragging an image, is it possible to implement it?
|
|
|
|
|
Hello,
Im trying to map a message from a range of
combo boxes controls to a single Message handler.
But, this is a CBN_EDITCHANGE message, which is not
a notification message (WM_NOTIFY format), so I
dont think I can use the macro ON_NOTIFY_RANGE (its not
working anyway). So, my questions are:
1.Is it possible to map this range of messages with
ON_NOTIFY_RANGE ?
2.If not, how do u map a range of messages that are in
a WM_COMMAND format to a single handler ?
THANK YOU,
Ariel
|
|
|
|
|
Hi Ariel,
you can the ON_CONTROL_RANGE macro in your case.
HTH
Martin
|
|
|
|
|
Hi
I have one small problem. In my code
i am posting onemessage using
PostMessage( WM_APP+n, int)
Handling this messge in some other function.
Problem is: buttons does not always react to quick clicks.
Can anybody tell me the reason why it is happening??
-- Thanks,
Koteswara
|
|
|
|
|
My create the CImageList object use bitmap.
How to let my bitmap in the CImageList object to be transparentize?
|
|
|
|
|
I figured out how to get my program to use dao360.dll and it can now open my access2000 database.
Now I am getting CString memory leaks during data exchange. Do I need to be in Unicode? Anyone else have this problem?
Thanks
|
|
|
|
|
VC++ 6.0
Win98 (MSIE 4.01), or WinNT4/SP5 (MSIE 5.0)
I'm trying to use an imagelist (attached to a CListCtrl) containing
icons.
// defined as
CImageList m_imageList;
// in the constructor, I have this code
CMyDialog::CMyDialog()
{
...
m_imageList.Create(16, 16, ILC_COLOR16, 0, 11);
m_imageList.SetBkColor(::GetSysColor(COLOR_WINDOW));
...
}
// in OnInitDialog()
BOOL CMyDialog::OnInitDialog()
{
...
m_ctrlList.SetImageList(&m_imageList, LVSIL_SMALL);
m_ctrlList.InsertColumn(0, "Application", LVCFMT_CENTER, 200);
m_ctrlList.InsertColumn(1, "Started", LVCFMT_CENTER, 120);
m_ctrlList.InsertColumn(2, "Msgs", LVCFMT_CENTER, 60 );
m_ctrlList.InsertColumn(3, "Last Recieved", LVCFMT_CENTER, 120);
...
}
When I add a list item, this code is executed whan an item is added to
the list control:
void CMyDialog::AddItem(HICON hIcon)
{
int nIndex = m_imageList.Add(hIcon);
LVITEM lvi;
lvi.mask = LVIF_IMAGE | LVIF_TEXT;
lvi.iImage = nIndex;
lvi.iItem = nIndex;
lvi.iSubItem = 0;
lvi.pszText = "Name";
m_ctrlList.SetItem(&lvi);
m_ctrlList.InsertItem(&lvi);
lvi.iSubItem = 1;
lvi.pszText = "01/01/2000";
m_ctrlList.SetItem(&lvi);
lvi.iSubItem = 2;
lvi.pszText = "0";
m_ctrlList.SetItem(&lvi);
lvi.iSubItem = 3;
lvi.pszText = "01/01/2000";
m_ctrlList.SetItem(&lvi);
}
Up to this point, everything works fine in both release and debug mode.
When I delete an item in the list control, this code is executed:
void CMyDlg::DeleteListCtrlItem(int nIndex)
{
int nCount = m_ctrlList.GetItemCount();
if (nIndex < nCount)
{
// remove the list ctrl item
m_ctrlList.DeleteItem(nIndex);
// remove the image from the imagelist
m_imageList.Remove(nIndex);
// decrement the item count
nCount--;
// start at the first item and reset the images
for (int i = 0; i < nCount; i++)
{
LVITEM lvi;
lvi.mask = LVIF_IMAGE;
lvi.iItem = i;
lvi.iImage = i;
m_ctrlList.SetItem(&lvi);
m_ctrlList.Update(i);
}
}
}
In debug mode, this works fine. In release mode, I don't get an image in
the list control. If there's an unitialized variable somewhere, it's
just got to be in the either CListCtrl or CImageList. I've used message
boxes to verify that the nIndex and nCount variables are within the
expected range, and I've tried a number of things as workarounds,
including:
- shuffling the images in the imagelist down one spot and removing the
last item.
- shuffling the images in the imagelist down one spot and using
SetImageCount() to reset the number of images.
- creating a CArray of HICONs and extracting the remaining icons from
the imag list, setting the imagecount to 0 and then re-adding the icons
If anyone has any ideas or sees something blatantly wrong with my code,
I'd appreciate hearing about it.
Many thanks in advance.
|
|
|
|
|
John,
Since you had an uninitialized local in DeleteListCtrlItem() , I changed the declaration to:
LVITEM lvi = {0};
and that fixed things right up.
|
|
|
|
|
Does anibody know if there's a similar function like CListBox::SetCurSel, in class CListCtrl?
In a multiple column CListCtrl, is it possible to select the entire row instead of only the first column?
Thanks!!!
|
|
|
|
|
1) CListCtrl::SetItemState()
2) Yep, set the full row select extended style of the control.
|
|
|
|
|
Hi there,
How do you select the "set the full row select extended style of the control" ??
Thanks in advanced,
Ariel.
|
|
|
|
|
In MFC: yourListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT|yourListCtrl.GetExtendedStyle());
In straight API: ListView_SetExtendedListViewStyleEx(hwndYourList, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
Thanks alot for this its working perfectly !!!
Hope to be able to help you once,
Ariel.
|
|
|
|
|
I have written a program using VisC++.
However, when I moved it to another location (not the place that VisC++ automatically puts things) the program stopped working properly.
I used the Release build configuration, and I can't seem to figure out what has gone wrong.
I do use some external data files, but they are in the same (relative) place as they were when they were in VisC++ MyProjects folder.
Does anyone know how to get my program working properly. Can it be my code? Because the program works perfectly when it is in the automatic location, just not anywhere else.
|
|
|
|
|
I don't think there's enough information here to provide you with a specific answer.
You're going to have to debug your app and find out what's failing. You can change the target directory for the compiled .exe to another location and use the standard debugger, or you could insert a small number of MessageBox calls to give you visual feedback that your application has reached a particular point in its execution.
Good Luck.
|
|
|
|
|
Many, many, many times when people ask for help they say things like "stopped working" and usually it is necessary to ask them for clarification of what they mean. You are not the first by far.
One good reason for us to ask for clarification is that many times when people ask for help they are able to help themselves simply by thinking through the problem enough to explain to someone else. Sometimes the cause of a problem is so obvious that it is easily overlooked.
|
|
|
|
|
Hi:
I have got an Exe A and a service B.
Is there any method that I only need ExeA and when I run ExeA,
ServiceB just comes out of it and is copied to a remote ( and local )
computer and then installed and started on it.
I know the second part may be a difficult one but if you could just
help me on how to piggybag ServiceB inside ExeA and extracted at
runtime
automatically.
I have tried one thing that I have tried to
read the Exe file in a char* or BYTE* and then saved it in a string to
display the contents in the dialog but it works for txt files etc.
but not for an Exe.
The I tried to Open the Exe in notepad and saved it with a different name but that new Exe is not valid . So the option of reading the Exe file and saving it temporarily in your ExeA as a variable and then extracting that is not working .
Any other trick or a hint......
|
|
|
|
|
import "B" into A's project as a custom resource. then use FindResource, LoadResource, UnlockResource in A to get a BYTE pointer to B. open a file, dump the contents of B into the file and... that's it.
-c
|
|
|
|