|
Hi,
I want to ask three question:
1.open file *.dbf in VC6 ?
2.how to load bitmap image from resource(use funtion Loadimage)?
3.how to process control run with indentify time left?
Thanks very much !
|
|
|
|
|
Load Image:
HBITMAP hBitmap =
(HBITMAP )LoadImage(AfxGetResourceHandle(),
LPCTSTR(IDB_BITMAP),
IMAGE_BITMAP, 0, 0,
LR_CREATEDIBSECTION);
LR_CREATEDIBSECTION ensures colours in your bitmap not mapped to the system palette.
Did not understand other questions.
|
|
|
|
|
for the .dbf you can use a crecordset object. For the connection string, there's an article on this site called "ADO Connection Strings" that will work
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
Hi,
I want to enlist local drives with their icons in the combobox . How can I do that?
Drushti
|
|
|
|
|
Hello Madame Nazar
I think this little piece of code can help you
[code]
CString CNMPDrivesClass::NMPChangeToBinary(DWORD dwVar)
{
long j=(long)dwVar;
int i,k=0;
char Binary[20];
CString str;
str.Format("%d",j);
while(j!=0)
{
i=j%2;
j=j/2;
if(i==0)
Binary[k++]='0';
else
Binary[k++]='1';
}
str.Format("%s",Binary);
return str;
}
void CNMPDrivesClass::NMPReturnNoOfDrives(CUIntArray &NoOfDrives)
{
CString str;
DWORD dwordVar=::GetLogicalDrives();
str=this->NMPChangeToBinary(dwordVar);
for( int drive = 0; drive < 26; drive++ )
{
if(str.GetAt(drive)=='1')
{
NoOfDrives.Add('A'+drive);
}
}
}
[/code]
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Mr. Alok,
Thanx for replying. Now can u please tell me how am I going to connect this code to my combobox.So that logical drives are visible.I have compiled your code. Its error free. But am not getting when and where to call NMPReturnNoOfDrives function in my application??
Thanking u in advance,
Drushti
|
|
|
|
|
Hello Miss Nazar,
it upto when to call these function as i don't know wheather you want to fill combo box on Initialization of Application or at middle.
these code are from my article,i had already published that under name of 'sysutil' u can check that.
anyway here it is small explaination->these fucntion return a mfc collection class,which contain all the drives letter in it one by one.
the below given funtion check type of Drive.
////////////////this function send the type of drives
//0 stand for floppy dirive
//1 stand for hardisk
//2 stand for cdrom
//3 stand for ramdisk
//4 stand for Network Drive
//5 stand for unkown
void CNMPDrivesClass::SendTypeOFDrives(CUIntArray &Stat)
{
CUIntArray Stat1;//this vaiable is created for getting drives list
this->NMPReturnNoOfDrives(Stat1);//getting drives
CString str;
for(int i=0;i<stat1.getsize();i++)
{=""
="" str.format("%c:\\",stat1.getat(i));
="" uint="" i="::GetDriveType(str);
" switch(i)
="" {
="" case="" drive_unknown:="" stat.add('5');
="" messagebox(null,str+"the="" drive="" type="" cannot="" be="" determined.","",mb_ok);="" break;
="" drive_no_root_dir:="" messagebox(null,str+"="" the="" root="" path="" is="" invalid.="" for="" example,="" no="" volume="" mounted="" at="" path.="" ","",mb_ok);
="" drive_removable:="" stat.add('0');
="" disk="" can="" removed="" from="" drive.="" drive_fixed:="" stat.add('1');
="" drive_remote:="" stat.add('4');
="" a="" remote="" (network)="" drive_cdrom:="" stat.add('2');
="" cd-rom="" drive_ramdisk:="" stat.add('3');
="" ram="" disk.="" }
="" }=""
-----------------------------
<i="">"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
class base{
virtual void operator=(*this object) = 0;
};
Why is that code invalid for the compiler?
what i need to do is to force all inhereted classes to realize this operator for their own class type.
is there a way of doing this?
Thanks.
|
|
|
|
|
If you're trying to define a base class that requires that classes derived from it implement their own assignment operator, try this:
class Base {
virtual Base& operator=(const Base& value) = 0;
};
Software Zen: delete this;
|
|
|
|
|
not exactly.
the purpose is to make the derived classes realize this method, however, the paramater of the method is the class itself (the one that realizes the method), which means that every class that derives from this base class will actually have a different parameter.
|
|
|
|
|
Does this help?
template<class T>
class base
{
public:
virtual T& operator=(const T& assignFrom) = 0;
protected:
~base() {}
};
class Foo : public base<Foo>
{
public:
virtual Foo& operator=(const Foo& assignFrom)
{
return *this;
}
};
Curiously Recurring Template[^]
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 your aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
i can't use templates. my code is meant for multi platform.
is there another way of doing this?
|
|
|
|
|
From your original question - why doesn't this work, it is because *this is a reference to an object, not an actual type.
virtual void operator=(*this object) = 0;
What are you really trying to achieve? If you want to be able to polymorphically assign objects you should look into the virtual constructor idiom and Co-variant return types. C++ FAQ Lite 20.6 - What is a "virtual constructor"?
AFAIK there is no standard portable way to extract the name of a class from an object without using templates or relying upon facilities built into specific compilers - all of which are far less standard than templates (which are now common and robust in C++). I believe that at one stage GCC had an experimental typeof operator. Some alternative implementations of typeof operators do exist however they all rely heavily upon templates, but even then I'm not sure it would help.
Just as an aside, templates are now implemented in all major C++ compilers, basic template techniques (like the one I demonstrated) will compile under every compilers I know (gcc, vc6, vc7, vc7.1, vc8, comeau, borland, intel, ... the list goes on) - I don't think you can get more platform independant than that.
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 your aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I have a bit of a problem and am not sure how serious it is. I'd appreciate any advice from the programming community here. A couple of months ago, we built a new MFC application using the MFC application wizard within Visual Studio .NET. I knew I wanted to implement a help system but wasn't really sure which one to use at the time. It was a low priority and we mainly just wanted to build the application and make it work first. Not having had much experience with MFC application development, we created the new application project to use winhelp. Now, after further review I've decided that we probably should have set it up to use HTML help. Is it a reasonable process to to manually change the code and files within the project directories? Has anyone ever had to do this? I'm wondering how much of a hassle it is going to be. If anyone has any insight on this or helplful tips, I'd appreciate it.
Right now my plan is to create two new side by side projects one using each kind of help. Then I want to evaluate the files and directories created by the wizard to see what the differences are. Hopefully, I can go back to the original application directories and tweak the settings and files/directories to changeover to HTML help. If anyone knows of a better way let me know. If you think that what I am doing is correct and the only way; let me know that too. I'd appreciate any input.
Thank you.
|
|
|
|
|
Since it sounds like you're a bit unfamiliar with MFC development, I think you're doing the right thing. Comparing the code the wizard generates for different choices will show you the basics on how different things are accomplished.
Another thing you can do is to run the wizard again, creating an application with the same attributes as yours (single or multiple document, view types, etc.) and using the same file and class names, but selecting HTML help this time. You can then cut/paste the bits and pieces you need out of the wizard-generated code into your existing application.
Software Zen: delete this;
|
|
|
|
|
Thanks, it seems like I have successfully done this and can now build and compile. However, the project that use to be the winhelp project, the .chm file is not being built. I thought I had changed all of the differences over and added all of the help directories and files to the project.
I've got the .hhc, .hhk, and .hhp along with the .htm directories. The project settings look exactly the same. But when I build, I can't seem to understand why my .chm file doesn't get built. What triggers this process? I just need a hint so that I can figure this out. Perhaps there is a bad path or something in a resource or .htm file I need to change. Any hints would be appreciated and thanks again for your time.
Regards,
Shawn
|
|
|
|
|
I just wanted to close out this thread. I figured it out. The actual project file itself is built by the application wizard with some directives for compiling the appropriate help file(.chm for HTML help). So you definitely have to use the app wizard to create a new project file. You can continue to use the already developed files such as mainframe.[cpp and h]. But you have to copy in paste in a new project file and recreate the solution as well. Also, the output directory (debug/release) need to be completely cleaned in order to eliminate all previous winhelp files that were compiler generated. Other than that, the process is straightforward. Since I hadn't already implemented a lot of the help associated with winhelp there was not much code to change. Just add a call to EnableHtmlHelp() in your application object constructor. I also had to copy all of files from the app wizard generated hlp directory from the new temp project into the old one so that I had all of the default .htm and .hh* files in the directory for working with the HTML files.
Shawn
|
|
|
|
|
I still use VS 6.0, but I guess my considerations could help.
All you need is to redefine the CWinApp virtual function WinHelp . Then, define a CString member m_strHelpFilePath and put a full path to your .chm in it in CApp::InitInstance . (You can do something different, but the idea is to form and store the .chm path).
Your WinHelp function might look like this:
void CApp::WinHelp(DWORD dwData, UINT nCmd)
{
HWND hwndDesktop = ::GetDesktopWindow();
if (!HtmlHelp(hwndDesktop,
m_strHelpFilePath,
HH_HELP_CONTEXT,
nCmd == HELP_CONTEXT ? dwData : 0)))
{
HtmlHelp(hwndDesktop, m_strHelpFilePath, HH_HELP_FINDER, 0);
}
}
If you want your main frame to own the help window frame, pass m_pMainWnd->GetSafeHwnd() instead of hwndDesktop .
Hope this helps.
|
|
|
|
|
I am under developing graphic programing. I already completed main parts. But there is problem. I used gdi implementing graphics, and so there is aliasing. It looks all figures nasty. I searched all the articles here, but I could not find any articles about antialiasing. Is there any good argorithm to apply antialiasing to my graphics without using gdi+. I also used gdi+, but the performance is not good for my graphics. please help me. thanks in advance.
|
|
|
|
|
The link:
http://alglib.manual.ru/translate.php?location=/graphics/wuline&target=cpp[^]
It is a Russian resource, I guess you don't speak Russian. So, here you are:
#include "ap.h"
void drawwuline(double x1, double y1, double x2, double y2);
double myfrac(double x);
void drawwuline(double x1, double y1, double x2, double y2)
{
double grad;
double xd;
double yd;
double length;
double xm;
double ym;
double xgap;
double ygap;
double xend;
double yend;
double xf;
double yf;
double brightness1;
double brightness2;
int x;
int y;
int ix1;
int ix2;
int iy1;
int iy2;
bool wasexchange;
int tmpint;
double tmpreal;
xd = x2-x1;
yd = y2-y1;
if( xd==0&&yd==0 )
{
return;
}
if( fabs(xd)>fabs(yd) )
{
wasexchange = false;
}
else
{
wasexchange = true;
tmpreal = x1;
x1 = y1;
y1 = tmpreal;
tmpreal = x2;
x2 = y2;
y2 = tmpreal;
tmpreal = xd;
xd = yd;
yd = tmpreal;
}
if( x1>x2 )
{
tmpreal = x1;
x1 = x2;
x2 = tmpreal;
tmpreal = y1;
y1 = y2;
y2 = tmpreal;
xd = x2-x1;
yd = y2-y1;
}
grad = yd/xd;
xend = floor(x1+0.5);
yend = y1+grad*(xend-x1);
xgap = 1-myfrac(x1+0.5);
ix1 = floor(x1+0.5);
iy1 = floor(yend);
brightness1 = (1-myfrac(yend))*xgap;
brightness2 = myfrac(yend)*xgap;
if( wasexchange )
{
setpixel(iy1, ix1, brightness1);
setpixel(iy1+1, ix1, brightness2);
}
else
{
setpixel(ix1, iy1, brightness1);
setpixel(ix1, iy1+1, brightness2);
}
yf = yend+grad;
xend = floor(x2+0.5);
yend = y2+grad*(xend-x2);
xgap = 1-myfrac(x2-0.5);
ix2 = floor(x2+0.5);
iy2 = floor(yend);
brightness1 = (1-myfrac(yend))*xgap;
brightness2 = myfrac(yend)*xgap;
if( wasexchange )
{
setpixel(iy2, ix2, brightness1);
setpixel(iy2+1, ix2, brightness2);
}
else
{
setpixel(ix2, iy2, brightness1);
setpixel(ix2, iy2+1, brightness2);
}
for(x = ix1+1; x <= ix2-1; x++)
{
brightness1 = 1-myfrac(yf);
brightness2 = myfrac(yf);
if( wasexchange )
{
setpixel(floor(yf), x, brightness1);
setpixel(floor(yf)+1, x, brightness2);
}
else
{
setpixel(x, floor(yf), brightness1);
setpixel(x, floor(yf)+1, brightness2);
}
yf = yf+grad;
}
}
double myfrac(double x)
{
double result;
result = x-floor(x);
return result;
}
|
|
|
|
|
thanks a lot. I'll try...
|
|
|
|
|
I just create the text ocx( called testocx.ocx) to load some object.
and load into IE. here is the source for html.
when i click button button it will show message said "OK" but
when I new window (in IE File->New-> Window),
"Error, cannot get dispatch object" message will be shown.
We have the same problem for our company
core program. I put the OCX source(AddObj method) for refrence.
maybe someone can point what is problem.
OCX source*******************************
BOOL CTestocxCtrl::AddObj(LPDISPATCH inserObj)
{
CInsertObj * CCmdTarget pObj = ( CInsertObj *)CCmdTarget::FromIDispatch(
inserObj);
if (!pObj){
AfxMessageBox("Error, cannot get dispatch object");
}
else{
AfxMessageBox("OK");
}
return TRUE;
}
test.html*********************************
<title>
<object id="DTestocx1" style="WIDTH: 354px; HEIGHT: 269px"
classid="clsid:361B6B0E-B8D4-47FD-A373-2F37A801F3CD"><param name="_Version"
value="65536" /><param name="_ExtentX" value="7493" /><param name="_ExtentY"
value="5694" /><param name="_StockProps" value="0" />
|
|
|
|
|
I'm trying to statically link some libraries(Xerces) into my application with VS 2003 .Net. I'm trying to do this by adding the libraries to the "Additional Dependencies" field under the "Linker" section of the project properties. After rebuilding the application with these settings, the application still tries to link to the dynamic versions of the libraries.
Did I miss something?
Thanks
Hua-Ying
|
|
|
|
|
wrong library?
Don't try it, just do it!
|
|
|
|
|
Check the docs, some libraries (like id3lib) require you to #define a symbol differently when you use a static LIB build versus a DLL build.
Also make sure you're not picking up a #pragma comment(lib,"...") in a Xerces header file.
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|