|
Hello, the codegurus around the world.;)
I'm curious why you use VC++ compiler to write the program in Unix box.
Unix has its own compiler like cc or gcc.
Or you don't know how to use vi editor or EMacs editor?
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Why assume that someone doesn't *know* about other compilers ? Maybe they prefer VC++ ??
|
|
|
|
|
I prefer don´t tell you why I need it but I`m sure that it is that I need. I know vi perfectly, so I`m sorry but you are confuse cause I don´t need VC++ to write a program in Unix, a piece of program is in Unix and the rest is in VC++. Are you O.K.?
|
|
|
|
|
Hi.
I have a dll that exports a few functions. I called the same function in two threads which is running concurrently in the same process. Does it interfere with each other? Especially the variables defined in the function?
Thanks
Agus
|
|
|
|
|
if you didn't use static or global variable then you ok.
good luck,
Dror
|
|
|
|
|
Whether your code is thread-safe depends entirely on how you wrote it. Stack variables will not cause a problem, since each thread has its own stack. Any static or global variables in the DLL can be access from multiple threads, however, so you should protect access to them with critical sections.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
<<< In the name of GOD >>>
Hi.
My program is in SDI mode, and also i use of CFormView(Form-Based program).
I have Editbox in my document, i want to get data from Editbox, wihout CSDIFormView.
It mean when i have focus in other dialog ....
It's my source code:
// SOURCE IN DIALOG ...
#include "sdiformview.h"
.
.
.
void CMyDialog::Button()
{
CSDIFormView *pV;
CString szText = pV->m_Edit;
AfxMessageBox(szText);
}
Please help me ...
Hadi Rezaie
|
|
|
|
|
Hello, the codegurus around the world.;)
There are a couple of ways to do your wish.
One is to use static function to get CWnd of FormView.
In MSDN help, you will find the followings.
HOWTO: Get Current CDocument or CView from Anywhere
Last reviewed: July 31, 1997
Article ID: Q108587
In detail,
For SDI application,
CMyView * CMyView::GetView()
{
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
CView * pView = pFrame->GetActiveView();
if ( !pView )
return NULL;
if ( ! pView->IsKindOf( RUNTIME_CLASS(CMyView) ) )
return NULL;
return (CMyView *) pView;
}
For an MDI application, the CMyView::GetView() code should be the following:
CMyView * CMyView::GetView()
{
CMDIChildWnd * pChild =
((CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd))->MDIGetActive();
if ( !pChild )
return NULL;
CView * pView = pChild->GetActiveView();
if ( !pView )
return NULL;
if ( ! pView->IsKindOf( RUNTIME_CLASS(CMyView) ) )
return NULL;
return (CMyView *) pView;
}
Now, from anywhere in your program, where the document or view header files have been included, you can call:
CMyView::GetView();
After you get CWnd of FormView, you can access CWnd of Edit control on CYourFormView.
You had better change from CMyView to CMyFormView.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hi Masaaki, and thanks a looot for reply.
But i couldn't write this program, because i'm begginer.
If possible, write small example about it, and send to me, Please please please ...
Hadi Rezaie
|
|
|
|
|
Hello all,
I've recently made a source-code navigater (Explorer look-alike, MFC application), on which one can doubleclick on a file. For source-code files, these files will then be opened in Microsoft Developer Studio (version 6).
My problem
----------
Sometimes the view of MSDEV is corrupted by contents of my MFC-application. When minimize and maximize MS-DEV, the view is correct again.
So actually I need to refresh the MSDEV environment, after opening a file from external application (my application).
Question
--------
How can I make MSDEV refreshing the view from an other application?
Many thanks,
EiSl
|
|
|
|
|
Hi,
I want to sort items in a CListCtrl. However, the sorting is not according to the first column. For example, when the user clicks on another column in the header, the list should be sorted according to that column.
I tried many methods, but I wasnt successful. I am waiting for your helps.
Thank you for any helps in advance
regards
Mustafa Demirhan
|
|
|
|
|
I don't know of an 'in list' solution - I do it by keeping the data in a structured array, then grab the button that has been clicked over and sorting the array by that 'colomn' values, then empty and reinsert. I remember using flexgrid once and it did it a whole lot easier, but was it's own world of grief in other areas...
|
|
|
|
|
Do a search on this forum for:
Sorting data in CListCtrl columns
I asked the same question. Let me know when you are done with the sorting implementation.
Ammar
|
|
|
|
|
Thanks a lot. I have solved the problem.
|
|
|
|
|
I try to create and show a bitmap based on one short array.No error occours during compile,but the bitmap just don't show on the view.
My code as follow:
void CReadfile1View::DrawDIBSection(HDC hDC , int xDest,int yDest,int w, int h,signed short*image)
{
BITMAPINFOHEADER *bih=0;
// HDC hDC=0;
HBITMAP hbm;
void *bits;
try
{ // allocate room for BITMAPINFOHEADER and color mask's
if(!(bih = (BITMAPINFOHEADER*)malloc(sizeof(BITMAPINFOHEADER))))
throw 0;
ZeroMemory(bih,sizeof(BITMAPINFOHEADER));
bih->biSize = sizeof(BITMAPINFOHEADER);
bih->biWidth = w; // .
bih->biHeight = h; // match array-size
bih->biPlanes = 1;
bih->biBitCount = 16;
bih->biCompression = BI_RGB; // we use 5:5:5 format
bih->biSizeImage = bih->biWidth * 2 * bih->biHeight;
if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION
if(!(hbm = ::CreateDIBSection(hDC,(BITMAPINFO*)bih,DIB_RGB_COLORS,&bits,0,0))) //
throw 0; // get the array into the DIBSECTION
if(::SetDIBits(hDC,hbm,0,h,image,(BITMAPINFO*)bih, DIB_RGB_COLORS) != h)
throw 0;
}
catch(...)
{
// cout<<"unknown type of exception throw"<<'\n';
}
HDC hDCMem=::CreateCompatibleDC(hDC);
HGDIOBJ hBmpOld=::SelectObject(hDCMem,hbm);
BitBlt(hDC,xDest,yDest,bih->biWidth,bih->biHeight,hDCMem,0,0,SRCCOPY);
::SelectObject(hDCMem, hBmpOld);
::DeleteDC(hDCMem);
if(hDC) ::ReleaseDC(0,hDC);
if(bih) free(bih);
}
void CReadfile1View::OnDraw(CDC* pDC)
{
CReadfile1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
DrawDIBSection(*pDC,10,10,WIDTH,HEIGHT,pDoc->Image[0]);
}
Who can tell me why it don't works and how to improve?!
thanx!
fly against the wind
|
|
|
|
|
Hi,
I didn't have much time to check your code completely, but I think the source line:
if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION
is incorrect.
You re-initialize the local parameter hDC, which was sent by the call to your DrawDIBSection(..) function in the OnDraw method. It will be set to a DC for the desktop, by ::GetDC(0).
This hDC is used for the BitBlt(..) command later.
Not a sollution, but just a hint...
Istvan Eperjesy
|
|
|
|
|
Hi All !!
I've stupid problem !!! It make me crazy
I want to use WinAPI struct ALTTABINFO
this struct is contained in <winuser.h>
but no way to use this struct because compiler performs an output:
error C2065: 'ALTTABINFO' : undeclared identifier
for example
//#include <winuser.h> //but I must include windows.h, look in help
#include<windows.h>
void main(void)
{
ALTTABINFO myInfo;// error!! why???
.....
}
Best regards VitSoft
|
|
|
|
|
If you do not have MSDN, get it and get it quick, you can't possible write windows programs without it (I have but that was many moons ago).
The ALTTABINFO structure contains status information for the application-switching (ALT+TAB) window.
typedef struct tagALTTABINFO {
DWORD cbSize;
int cItems;
int cColumns;
int cRows;
int iColFocus;
int iRowFocus;
int cxItem;
int cyItem;
POINT ptStart;
} ALTTABINFO, *PALTTABINFO, *LPALTTABINFO;
Members
cbSize
Specifies the size, in bytes, of the structure.
cItems
Specifies the number of items in the window.
cColumns
Specifies the number of columns in the window.
cRows
Specifies the number of rows in the window.
iColFocus
Specifies the column of the item that has the focus.
iRowFocus
Specifies the row of the item that has the focus.
cxItem
Specifies the width of each icon in the application-switching window.
cyItem
Specifies the height of each icon in the application-switching window.
ptStart
Specifies the top-left corner of the first icon.
Requirements
Windows NT/2000 or later: Requires Windows NT 4.0 SP6 or later.
Windows 95/98/Me: Requires Windows 98 or later.
Header: Declared in Winuser.h; include Windows.h.
See Also
Windows Overview, Window Structures, GetAltTabInfo
|
|
|
|
|
Hi !!!
Thanks !!
I've MSDN lib,I know it possible to redefine this struct, but when you want use GetAltTabInfo(..) function
you have the same problem.
Why compiler don't know about this function or struct ?
error C2065: 'GetAltTabInfo' : undeclared identifier
I'm a long time work with VC, but it's first time when i have problem like this ;(
Thanks and Good Luck
|
|
|
|
|
If you look in winuser.h, you'll see the ALTTABINFO declaration is wrapped in an #if (WINVER >= 0x0500) block. You'll need to #define WINVER 0x0500 before your #include statements.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
I need to change the MSysObjects attributes to read only thru VC.
I will be able to read tables info if I could do that. By default, MSysObjects cannot be read. I can change the setting thru Access 2000 but I want to do it thru VC.
Help!
Ammar
|
|
|
|
|
Is there a function that will tell me if
Day Light Savings is turned on and if an OS is
running in summer or winter
Warm Regardz
|
|
|
|
|
I think the CRT variable _daylight indicates whether daylight savings time is in effect. The docs aren't exactly crystal clear, though.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Thanks for the speedy response Mike,
Yes you are right !
but its now proving a devil to test for
I'll implement it anyway as its several months before DST comes into effect here, To see if it works correctly.
Regardz
Colin
|
|
|
|
|
I am looking for a fast algorithm for outputing the co-ordinates of points along an ellipse, given the bounding rectangle.
Basically as the Ellipse drawing function only that it outputs the co-ordinates of the pixels rather than drawing them.
Any suggestions would be gratefully received.
Happy programming!!
|
|
|
|
|