|
i have did this. even though prob is same nothing is coming.
i have to use buffer as there is so much flicering comin in print preview window as resizing and all due to direct drawing on display dc.
if (pDC->IsKindOf(RUNTIME_CLASS(CPreviewDC)))
{
//using buffer and copying from mem DC to preview DC causes problem. so
//we directly draw on preview DC during preview.
memDC.CreateCompatibleDC(pDC);
bmp.CreateCompatibleBitmap(pDC, pDC->GetDeviceCaps(HORZRES), pDC->;GetDeviceCaps(VERTRES));
memDC.SelectObject(&bmp);
memDC.SetAttribDC(pDC->;GetSafeHdc());
//pMemDC = pDC;
pMemDC = &memDC;
}
|
|
|
|
|
Does BitBlt succeed at all?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
yes it does in both the case (display and print preview)
the rc i m passing to bitblt and CreateCompatibleBmp is of 6400 ,4900 i think this is the one u were talking abt so its correct right ??
in case of printing m already setting m_rcPrintrect as above size
|
|
|
|
|
_T("No name") wrote: my drawing coming distorted
What you meant by distorted?
You may try SetStretchBltMode, with HALFTONE, then use StretchBlt.
(If my guess is correct... )
- ns -
|
|
|
|
|
i tried this also this didnt help. i have uploaded the code i think this will help u
thx
|
|
|
|
|
I have a class that implements two interfaces, IA and IB. Some portions of the code manipulate objects through IA pointers and other parts of the code manipulate objects through IB pointers. I would like those IA and IB clients to hold shared_ptr(ia) and shared_ptr(ib) instead of raw pointers. However, the ref count of one of the pointers could reach 0 before the other, delete the object and make the other pointer invalid.
How do I practice safe use of smart ptrs of different interfaces to the same object?
Thanks
|
|
|
|
|
If you use Boost shared_ptr s[^], the reference count is held on the object rather than the interface you're using - consider this code:
#include <boost/shared_ptr.hpp>
#include <iostream>
class A
{
public:
~A() { std::cout << "A::~A()\n"; }
};
class B
{
public:
~B() { std::cout << "B::~B()\n"; }
};
class C : public A, public B
{
public:
~C() { std::cout << "C::~C()\n"; }
};
int main(int argc, char** argv)
{
{
std::cout << "Enter pC\n";
boost::shared_ptr<C> pC(new C);
{
std::cout << "Enter pB\n";
boost::shared_ptr<B> pB (pC);
std::cout << "Exit pB\n";
}
{
std::cout << "Enter pA\n";
boost::shared_ptr<A> pA (pC);
std::cout << "Exit pA\n";
}
std::cout << "Exit pC\n";
}
}
The output is
Enter pC
Enter pB
Exit pB
Enter pA
Exit pA
Exit pC
C::~C()
B::~B()
A::~A()
so, the object is only destructed once, when pC goes out of scope.
|
|
|
|
|
Thanks for the response. Unfortunately, I was not clear enough in my question. The original shared_ptr is a pointer to one of the base classes. Here is an example:
shared_ptr<Base1> pBase1(new Derived);
Derived* pDerived = dynamic_cast<Derived*>(pBase1.get());
shared_ptr<Base2> pBase2(pDerived);
This code will crash but I want to accomplish the spirit of the code:
1) Create an object.
2) Somewhere in client code, have safe access to the object in terms of a pointer to one base class.
3) Somewhere else in client code, have safe access to the object in terms of a pointer to another base class.
This appears to be more of a design question than a pointer/multiple inheritance use question.
Thanks
|
|
|
|
|
If you're using Boost shared pointers, that's easy enough to resolve - use boost::dynamic_pointer_cast , documented on this page[^], in place of dynamic_cast . Here's some code of similar shape to yours that uses it:
#include <iostream>
#include <boost/shared_ptr.hpp>
class A
{
public:
virtual ~A() { std::cout << "~A\n"; }
};
class B
{
public:
virtual ~B() { std::cout << "~B\n"; }
};
class C : public A, public B
{
public:
virtual ~C() { std::cout << "~C\n"; }
};
int main(int argc, char** argv)
{
boost::shared_ptr<A> pA(new C);
boost::shared_ptr<C> pC = boost::dynamic_pointer_cast<C>(pA);
boost::shared_ptr<B> pB(pC);
}
|
|
|
|
|
Thanks a bunch. That works great!
|
|
|
|
|
How can I convert a CString variable to a binary string, so that I can write it to the text file in binary form and Read CString form?
i am converting CString to Binary like this.
CString strRet;
CString strname="ABCDEF";
for (int i = 0; i < strname.GetLength(); ++i) {
CString str;
str.Format("%2.2x", strname[i]);
strRet += str;
}
AfxMessageBox(strRet);
But i don't know how to convert this Binary values to CString?
Plz help me
|
|
|
|
|
Your function merely transforms the original string in another one, the latter containing the character codes of the former one, represented as two-digits hexadecimal values. What do you want to do, really?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Do you want that user should not be able to read the strings when they open the files in notepad or some text editor?? If yes i will suggest to use some simple encryption rather than converting the string to hex/binary.
Regards,
Sandip.
|
|
|
|
|
in your code you can do easily this:
CString strname="ABCDEF";//if Unicode use the macro => TEXT("ABCDEF")
//no transforming needed
AfxMessageBox(strname);
writing and reading data have only to be compatible. There is a tiny MFC class for it:
http://msdn.microsoft.com/en-us/library/aa314304(VS.60).aspx[^]
try it out and step-debug in the sources.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: ";//if Unicode use the macro => TEXT("ABCDEF")
no, use TEXT() ( or _T() ) anytime you use CString with literals.
if using CStringW, then prepend the literals with L, and if using CStringA, then don't do much as writing the literal like you normally do.
_T() will extend to the unicode or ansi version depending on the compilation mode, so you don't have to bother about it.
|
|
|
|
|
Hi,
I have created multiple dockablepanes in the childframe, but I have one problem. There are four dockable panes in my childframe and the splitter for only the last dockable pane is only seen. When I double click or adjust the last pane's splitter or click on the "Auto Hide" button of any of the dockable panes or close any of the dockable panes, then only all the other panes splitters are seen. Please let me know as how to make the splitters of all the panes visible as soon as run my application.
Thanks in advance.
Taruni
|
|
|
|
|
Hi All
can any one help me how to encrupt string and write in text file and dcrypt string at the time file read?Plz help me
|
|
|
|
|
Did you see Encrypt Sample: File Encryption[^]
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
If it is really 'Urgent' then you may consider to rent a coder.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi All,
I am using gethostbyname function to get ip from name. It works fine if ip is defined. But if 'Obtain ip address automatically' settings is on, this function gives some different ip. Any help please.
Thanks
|
|
|
|
|
manish rastogi wrote: using gethostbyname function to get ip from name
The IP of what computer - your computer? A remote computer?
manish rastogi wrote: if 'Obtain ip address automatically' settings is on, this function gives some different ip
Where is 'Obtain ip address automatically' set - on your computer? And 'different ip' for what - your computer, a remote computer?
|
|
|
|
|
'Obtain ip address automatically' set - on remote computer, got different ip. 'Prefered DSN Server' settings had wrong value. After changing it got correct ip.
|
|
|
|
|
manish rastogi wrote: But if 'Obtain ip address automatically' settings is on, this function gives some different ip.
Which is the whole essence of DHCP. The gethostbyname() function does not care how your computer obtained its IP address.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I am using a grid view in a mulitdoc application.while horizontal scrolling the titles of the grid is not updating.But the data in the grid is updating.
Is there is any method to refresh or repaint.
thanks in advance
Deepu
|
|
|
|
|
Hello all,
I am currently doing my FYP. I download a set of header files of libxml2 with .h files and .lib files.
I first try to create a windows 32 application console application and it works fine (to ensure i link it properly)
I then head off and try to create a DLLs for the smart device, however, i return with the following errors:
Linking...
1> Creating library Windows Mobile 6 Professional SDK (ARMV4I)\Debug/TESTTESTTEST.lib and object Windows Mobile 6 Professional SDK (ARMV4I)\Debug/TESTTESTTEST.exp
1>TESTTESTTEST.obj : error LNK2019: unresolved external symbol xmlParseFile referenced in function ExportedFunction
1>Windows Mobile 6 Professional SDK (ARMV4I)\Debug/TESTTESTTEST.dll : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\wu\My Documents\Visual Studio 2005\Projects\TESTTESTTEST\TESTTESTTEST\Windows Mobile 6 Professional SDK (ARMV4I)\Debug\BuildLog.htm"
1>TESTTESTTEST - 2 error(s), 1 warning(s)
I created my DLL like this:
#include "resourceppc.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "xmlmemory.h"
#include "parser.h"
extern "C" void EXPORT ExportedFunction(){
char * docname = "abc";
xmlDocPtr doc;
xmlNodePtr cur;
doc = xmlParseFile(docname);
}
Being noob, i just want to know:
1. It is possible to create a DLL using .lib files ?
2. Is my linking wrong ?
Any help of somekind will be greatly appreciated !
Thanks,
Leslie
|
|
|
|