|
against
file << static_cast<unsigned char>(i) << i * 100;<br /> , can you try the following and return the result here please ?
file << static_cast<unsigned char>(i) << (int)(i * 100);
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I tried that a few times, no luck... The result is the same.
Blog[^]
|
|
|
|
|
Not sure why that happens, but for a workaround you could use ofstream's write() method. It seems to work the way you want:
<code>
unsigned int t = i*100;
file.write((const char*)&t, sizeof(unsigned int));
</code>
|
|
|
|
|
I currently use that method, but it's marked as deprecated in VS 2005.
Thanks for your reply
Blog[^]
|
|
|
|
|
I created two horizontal panes using CSplitterWnd. The top pane is from CView and the bottom pane from CScrollView. The splitter windows are static. My doubt is how to make the size of the panes to be fixed such that the user cannot resize the panes. Can anyone please help me out?
|
|
|
|
|
|
What's the easiest way to display a DIB when I have its handle which is a HBITMAP ? I found some functions which display it (the DIB) but for those I need some parameters which I don't have. I need a function, or member function of some class which would display it taking as argument the handle to the DIB (the HBITMAP), and the position .
|
|
|
|
|
Create a memory device context and then select the bitmap into it using SelectObject. You can then use BitBlt to copy it to the DC of your window to display it.
Have a look at the Windows GDI section of MSDN, that might help.
|
|
|
|
|
Well that's what I did ,basically . As you can see bellow I also have a function which makes my DIB from a DDB(the funnction is ConvertToDIB).I called this function before the SelectObject call .I don't know why I can't display the DIB (I see a white window when I try to open an image).
I transformed the DDB into DIB so I can modify it (for now I don't know how to modify it , but I just want to display it first ).Here's the code :
void CDoiView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
sizeTotal.cx = sizeTotal.cy = 0;
CleanUp();
CDoiDoc* pDoc = GetDocument();
CString strPath = pDoc->GetPathName();
if (!strPath.IsEmpty())
m_handlerToBMP = GetBitmapFromFile(strPath);
if (m_handlerToBMP){
GetBitmapDimensionEx(m_handlerToBMP, &sizeTotal);
}
SetScrollSizes(MM_TEXT, sizeTotal);
CDC* pDC=GetDC();
HDC hMemDC;
hMemDC=CreateCompatibleDC(pDC->GetSafeHdc());
if (hMemDC)
{
if (m_handlerToBMP){
bool aa;
if ( (aa=ConvertToDIB(m_handlerToBMP))==false )
{ AfxMessageBox("eroare ConvertToDIB");}
// select new bitmap into memory DC
HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_handlerToBMP);
//alocam memorie pentru tabloul ce contine informatia despre culoarea pixelilor
GetBitmapDimensionEx(m_handlerToBMP, &sizeTotal);
//transfer din memorie in fereastra
::BitBlt(pDC->GetSafeHdc(),0,0,sizeTotal.cx,sizeTotal.cy,hMemDC,0,0,SRCCOPY);
// select old bitmap back into memory DC and get handle to bitmap
SelectObject(hMemDC, hOldBitmap);
DeleteObject(hOldBitmap);
DeleteDC(hMemDC);
}
Invalidate();
UpdateWindow();
}
}
|
|
|
|
|
Hi
I am using a VC DLL in VB application and my DLL function is
void __stdcall ShowMainDialog( HWND hwnd,LPCTSTR lpStr_Title,
LPCTSTR lpStr_ExePath
LPCTSTR lpStr_ID, LPCTSTR lpStr_URL1,
LPCTSTR lpStr_URL2,
LPCTSTR lpStr_URL3,
LPCTSTR lpStr_URL4,
LPCTSTR lpStr_URL5,
LPCTSTR lpStr_URL6, int nDLG_ID))
{
//some code here
}
this dll is working perfectly in VC application but in VB application i am recving wrong arguments and order of parameters are not sequentially
e.g. hwnd recvd a junk long value
lpStr_URL1 is recving lpStr_ExePath
please tell me how can i solve this problem
Manoj Jangid
|
|
|
|
|
Hi all,
I am trying to load a image(GIF,JPEG or BMP) from file into a specific control in Win32 SDK.I have tried using LoadImage function.Is there any other method for doing this?Also i want to strech and compress the image according to window size.
Amruta
|
|
|
|
|
amrutajoshi wrote:
LoadImage
LoadImage only loads BMP files, it's has no support for JPEG and Gif images
amrutajoshi wrote:
there any other method for doing this
You can use IPictureDisp Interface to load Image File or
Could use Open Source Library like CXimage for loading different graphics format.
amrutajoshi wrote:
Also i want to strech and compress the image according to window size.
Method describe above give you BITAMP HANDLE To image and using BitBlt and StretchBlt, you can Stretch and compress the IMAGE on FlY!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Damned! You were faster than me!
|
|
|
|
|
Stlan wrote:
You were faster than me
Sorry, Next Time I will type Little Slow
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Yes please. But make also use of your left little finger only. Thanks in advance.
|
|
|
|
|
But i dont know anything about OLE.Is there any API for it?
|
|
|
|
|
HI Amruta,
Download this demo application from Microsoft,it's explain every thing about loading and displaying Images
LOADPIC.exe[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi,
Thanks Alok it's working.
Whether it is possible to stretch and compress such an image(means created using IPicture Interface) using StretchBlt function or I've to use any other functio?
|
|
|
|
|
amrutajoshi wrote:
using StretchBlt function or I've to use any other functio?
yes it's possible,look for IPicture::get_Handle Method
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
You should find happiness here. Good luck!
|
|
|
|
|
I want to do some processing in a BHO on the submit event. For this, I want to attach my own C++ function using put_onsubmit of the IHTMLFormElement. My problem is as to how do I create a IDispatch interface for this specific requirement (event handler for Submit button on a form). Lastly, I also want to know as to how I can manage multiple event handlers, if there are multiple forms on a page, which would have one or more submit buttons. Basically, I want to attach my event handlers at each of the Submit buttons. Later (when form is submitted), I would like to know which one has been called.
Thanks a lot for your concern.
Jitendra Loyal
|
|
|
|
|
How can i transfer same format?
i send file on network but on client side not recieved same format.
i used Myobj class
[Serializable]
public class MyObject
{
public int size;
public byte[] buffer=null;
public string str="hello string";
public MyObject()
{
}
Server send data on network as
public void senddata(string fname)
{
MyObject obj=new MyObject();
//Create a file stream from an existing file.
FileInfo fi=new FileInfo(fname);
FileStream fs=fi.OpenRead();
//Read 100 bytes into an array from the specified file.
// int nBytes;
byte[] ByteArray=new byte[(int)fs.Length];
obj.size=(int)fs.Length;
obj.buffer=ByteArray;
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(st.BaseStream, obj);
st.BaseStream.Flush();
}
& on client side receieved data as
public void receivedata()
{
MyObject obj=new MyObject();
IFormatter formatter = new BinaryFormatter();
obj =(MyObject)formatter.Deserialize(at.BaseStream);
Encoding ascii = Encoding.ASCII;
Encoding unicode = Encoding.Unicode;
byte[] ByteArray=new byte[obj.size];
byte[] asciiBytes = Encoding.Convert(ascii, unicode, obj.buffer);
// at.BaseStream.Read(ByteArray, 0, 11);
FileStream fs1=File.Create("c:\\clock1.avi");
fs1.Write(obj.buffer,0,obj.size);
fs1.Close();
ptr(obj.size.ToString());
ptr(obj.str);
}
kindly tell default encoding technique or any other solution
from which we receieve same format on server & client side
Rashaida
Rashaida
|
|
|
|
|
Hi friends,
Why new operator needs to know size of the user defined data types like class in C++
Vikram S
|
|
|
|
|
new operator has to allocate memory based on data type.
|
|
|
|
|
Okey..But Why it must know data type and also it's size? Can it just allocate memory run time?
|
|
|
|