|
I have try to gray the desktop when my program runs. by there are still some problems:
1, If I use CreateDIBSection, What bitsperpixel should I use, 8, or >8?
2, If I can use 32bits, even on 16 desktop settings?
|
|
|
|
|
hi.. I wanna open a folder from my software...Can i do that??????
|
|
|
|
|
I don't know exactly what you mean, but try looking up
SHBrowseForFolder in the MSDN Lib
maXallion "Look for bugs, I hate bugs!" - Warden, The Mummy www.maxallion.de - coded evil & more
|
|
|
|
|
I have two different times on my box...In VC++ the time says "1:40" and in the System Tray it says "8:40"?? Even when I write a program using the System time in VC++ I get the C++ time and NOT the actual System Time??
Settings:
Region(Locale)/Keyboard: U.S.
Time Zone: Germany (-1)
The funny thing is this is the Time (-7 hours) as our Mother Company in the US. I hope someone can show where the problem is.
Thanks in advance,
Dan
|
|
|
|
|
You don't say what function you use to get the time, but if you use time(), you have to convert the time with localtime() to get the local time...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Does anybody know the way to get rid of the thick (client?) border around the edit portion of combo box? Regular methods (that work with other controls) seem to have no effect.
Trying to make a property list control.
Thanx,
Dejan,
Melbourne
|
|
|
|
|
The example of a code, which one is fine draws on a screen, but is absolutely failed to print (except for a framework of an rectangle).
CTestView::OnDraw(...)
{
CBitmap m_bitmap;
m_bitmap.LoadBitmap(IDB_ ...);
CBrush m_brush;
m_brush.CreatePatternBrush(&m_bitmap);
CBrush * pSysBrush = pDC->SelectObject(&m_brush);
pDC->Rectangle(0, 0, 300, 300);
pDC->SelectObject(pSysBrush);
}
How to make correctly?
|
|
|
|
|
When you print you'll be working with a much bigger DC than on the screen. It probably printed a dot somewhere near the top. You need to query the printer DC to find out it's size and then scale the bitmap accordingly.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I want to add a Capture Video ActiveX in my program.
When I add the ActiveX in my mainframe (CMyAppDlg) and that I use the associated functions with this activeX, I don`t have any problem.
But I want to add this ActiveX in a modeless windows created by a item menu. The problem is when I include this ActiveX in my modeless windows and that I call the associated functions to the ActiveX, I have a Assertion Error: "Debug Assertion Failed!" in the file "Winocc.cpp" for each call of a function of this ActiveX.
So, I don't know why the ActiveX work in my mainframe but doesn't work in the modeless Windows since I use the same code in the two manner?
Thanks for your help!
Francis B.
|
|
|
|
|
I'm having the same problem with a different ActiveX control I'm using
in a modeless dialog from within a DLL. For some reason it seems as though
the ActiveX control is not being created properly during the call to
Create(). Mine always has a NULL hWnd after the call to create so whenever
a method on the control object gets called it bombs out with that same
assertion error you're getting because the control has actually not been
created properly. I wish I had a solution for you, this one is driving
me crazy!
|
|
|
|
|
Alright, I have created an SDI app and, using Navigate2() have loaded a page. I have used the OnDocumentComplete() to allow me to know when it is done loading. How can I get the source code for that page?
Thanks!
Adam
cabadam@houston.rr.com
|
|
|
|
|
CComPtr<ihtmlelement> m_pBody;
CComPtr<iwebbrowser2> spBrowser;
HRESULT hr = QueryControl(__uuidof(spBrowser), reinterpret_cast<void**>(&spBrowser));
if( SUCCEEDED(hr) )
{
CComPtr<idispatch> pDisp;
if( SUCCEEDED(spBrowser->get_Document(&pDisp)) && pDisp )
{
HRESULT hr = pDisp.QueryInterface(&m_pDoc);
if( SUCCEEDED(hr) && m_pDoc )
{
if( SUCCEEDED(m_pDoc->get_body(&m_pBody)) && m_pBody )
return TRUE;
}
}
}
return FALSE;
|
|
|
|
|
CComPtr m_pBody;
But... isn't CComPtr a templated class? What would I use as the template type?
Adam
cabadam@houston.rr.com
|
|
|
|
|
Hi.
Does anyone know of a way to emphasize or highlight specific items in a list box, and/or in the list portion of a combo box?
eg: The list box contains a number of items, all of which must be visible, but only some of which are "valid" selections for the user (invalid items can be selected, but have different effects). I need a visible difference between valid & invalid choices within the box (different text color, check mark, etc).
I would rather not get into owner drawn, since that is completely new to me.
Thanks.
Wayne Janaway
|
|
|
|
|
|
I need to copy entire directory including subdirectories and files to
some destination. What is easiest way to do this?
Bad judgement gives Good experience;
Good judgement comes with Bad experience
|
|
|
|
|
Probably could be done better, but it worked for what I needed at the time.
#include <io.h>
#include <list>#include <string>
#include <windows.h>
#include <shlwapi.h>
void CopyFolder(TCHAR* szSource, TCHAR* szTarget);
void CreatePath(TCHAR* szPath);
std::list<tchar*> SourceFolders;
std::list<tchar*> TargetFolders;
std::list<tchar*>::iterator SourceItr;
std::list<tchar*>::iterator TargetItr;
int main(int argc, char* argv[])
{
TCHAR szSource[_MAX_PATH] = "C:\\Source";
TCHAR szTarget[_MAX_PATH] = "C:\\Target";
CopyFolder(szSource, szTarget);
return 0;
}
void CopyFolder(TCHAR* szSource, TCHAR* szTarget)
{
CreatePath(szTarget);
SourceFolders.push_back(szSource);
TargetFolders.push_back(szTarget);
TCHAR szCurDir[_MAX_PATH];
GetCurrentDirectory( _MAX_PATH, szCurDir );
SetCurrentDirectory( SourceFolders.back() );
WIN32_FIND_DATA FindData;
HANDLE hFile;
if( ( hFile = FindFirstFile( "*.*", &FindData ) ) != INVALID_HANDLE_VALUE )
{
do
{
if( !strcmp(FindData.cFileName, ".") || !strcmp(FindData.cFileName, "..") )
continue;
if( FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
TCHAR szTemp[_MAX_PATH];
strcpy(szTemp, SourceFolders.back());
strcat(szTemp, "\\");
strcat(szTemp,FindData.cFileName);
TCHAR szTemp2[_MAX_PATH];
strcpy(szTemp2, TargetFolders.back());
strcat(szTemp2, "\\");
strcat(szTemp2,FindData.cFileName);
BOOL bTest = CreateDirectory(szTemp2,NULL);
CopyFolder(szTemp, szTemp2);
}
else
{
TCHAR szNewFile[_MAX_PATH + _MAX_FNAME];
TCHAR szOldFile[_MAX_PATH + _MAX_FNAME];
strcpy(szNewFile, TargetFolders.back());
strcat(szNewFile, "\\");
strcat(szNewFile, FindData.cFileName);
strcpy(szOldFile, SourceFolders.back());
strcat(szOldFile, "\\");
strcat(szOldFile, FindData.cFileName);
if( !CopyFile(szOldFile, szNewFile, FALSE ) )
DWORD dwErr = GetLastError();
}
}while( FindNextFile(hFile, &FindData) );
}
SourceFolders.pop_back();
TargetFolders.pop_back();
if( SourceFolders.size() )
SetCurrentDirectory( SourceFolders.back() );
}
void CreatePath(TCHAR* szPath)
{
TCHAR szTempPath[_MAX_PATH];
strcpy(szTempPath,szPath);
TCHAR* pszFind;
std::list<tchar*> Path;
while( !PathIsDirectory(szTempPath) )
{
TCHAR* szTemp = new TCHAR[_MAX_PATH];
strcpy(szTemp, szTempPath);
Path.push_back(szTemp);
pszFind = strrchr(szTempPath, '\\');
int iPos = pszFind- (szTempPath + 1);
strncpy(szTempPath,szPath,iPos+1);
szTempPath[iPos+1] = '\0';
}
while( Path.size() )
{
CreateDirectory(Path.back(),NULL);
Path.pop_back();
}
|
|
|
|
|
I use this recursive funtion. basically is loops through the directory and copies files. if it finds a directory then it calls the function with that directory.
hope it helps.
OldFilesMask: the directory that contains the files. in the format of "C:\Directory\*".
NewFilesDirectory: the directory the files are being copied to. in the format of "E:\Directory"
void CCustomerDlg::CopyDiskFiles(CString OldFilesMask, CString NewFilesDirectory)
{
CString strOldSearchFile, strOldFile, strNewFile, strNewSearchFile;
CString strNewMask, strFileName, strMessage, strTemp;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
int iSlash;
hFind = FindFirstFile(OldFilesMask, &FindFileData);
while (hFind != INVALID_HANDLE_VALUE)
{
strFileName.Format("%s", FindFileData.cFileName);
if (strFileName != "." && strFileName != "..")
{
strOldFile = OldFilesMask;
iSlash = strOldFile.ReverseFind('\\');
strOldFile.Delete(iSlash, strOldFile.GetLength() - iSlash);
strNewMask.Format("\\%s", strFileName);
strOldFile.Insert(iSlash, strNewMask);
strNewFile.Format("%s\\%s", NewFilesDirectory, strFileName);
if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
{
strOldFile = OldFilesMask;
CreateDirectory(strNewFile, NULL);
iSlash = strOldFile.ReverseFind('\\');
strOldFile.Delete(iSlash, strOldFile.GetLength() - iSlash);
strNewMask.Format("\\%s\\*", strFileName);
strOldFile.Insert(iSlash, strNewMask);
CopyDiskFiles(strOldFile, strNewFile, Product);
}
else
{
if (!CopyFile(strOldFile, strNewFile, FALSE))
{
strMessage.Format("Copy: '%s' to '%s' failed.", strOldFile, strNewFile);
AfxMessageBox(strMessage);
}
}
}
if (!FindNextFile(hFind, &FindFileData))
{
if (GetLastError () == ERROR_NO_MORE_FILES)
break;
}
}
FindClose(hFind);
}
Not much error checking but it fits my need. it may need some minor changes for your needs.
good luck
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
http://www.codeproject.com/shell/cshellfileop.asp
The above link provides wrapper for the shell function, which can optionally display the progress bar similar to windows while copying files. Its a wrapper for existing Shell API.
Hope this helps.
Cheers
Kannan
|
|
|
|
|
I want to be able to create a CToolbar control on the fly by reading from a text file. The text file will tell me the number of buttons, the name for each of the button, the bmp file that has the bitmap for each button (or the image id and a bmp file with an image list).
I have to be able to read this file and create the toolbar in my SDI MFC app. Can someone, please show me, how I could form the imagelist from these bitmap files?
Thanks
S
|
|
|
|
|
Use ImageList_LoadImage to load image from file into imagelist. There's no MFC wrapper over this function, so you'll also have to use CImageList::operator HIMAGELIST().
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks .. it worked.
|
|
|
|
|
Does anyone know any function in VC++ that can let me access or read or write data from or to COM port??
|
|
|
|
|
Yes, WriteFile and ReadFile will do the trick. It is here on msdn:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecomm/htm/serial_8.asp?frame=true
This goes through opening, configuration, reading and writing.
|
|
|
|
|
Does anyone know any function in VC++ that can let me access or read or write data from or to COM port??
|
|
|
|
|