|
I would attempt to create a separate application that does nothing but open the file in question. Build upon that until the problem re-appears.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
hi all
can any one pleas e help me to read and write struct using CArchive file.
thanks.
|
|
|
|
|
|
See also :
void TestExchange(CArchive& ar, POINT& pt)
{
if (ar.IsStoring()) {
ar.Write(&pt, sizeof(POINT));
} else {
ar.Read(&pt, sizeof(POINT));
}
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
I have a dialog CTest.
I have placed a edit control m_Edit1
In the dialog CTest.CPP file I have created a thread with a global function void Update()
I need this global function to update the value of m_Edit1 every cycle in the thread. Since m_Edit1 is a Class member, I unable to access the member variable inside the global function.
Please provide me all the possible alternatives to access a member variable and member function from a global function.
|
|
|
|
|
You can only access the variable through the object, so you need to send a pointer to the object into the global function. Perhaps you need to look at your design.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I used a global pointer to the dialog class. I initialized the global pointer to "this" pointer inside the OnInitDialog() function. Then I used the global pointer in the global function to call the member function. The member function is called, but when I try to update values in the edit control using UpdateData(FALSE) the application crashes.
|
|
|
|
|
You mentioned that you are using another thread. MFC classes are not thread safe. To communicate with Windows controls from another thread, use the API PostMessage() function in your thread passing the handle of the control window. Alternatively post user defined messages and handle them in your CDialog derived class.
|
|
|
|
|
|
Hi,
I am getting a CInvaliArg exception after Doing CWnd::SendMessage
The CWnd is a CDialog
The Wparam and Lparam are both pointers
The ONMESSAGE procedure has WPARAN LPARAM paramters
What Causes a CInvalid Arg Exceptions ??
|
|
|
|
|
You could try stepping into the SendMessage function to see what causes it to bomb.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Without seeing the exact code no one can guess what you are doing wrong.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Durning The INITINSTANCE of my CWinApp I allocate via new operator a Derived CEvent class
This CLass has
1) buffer allocated via new in the contructor of a command that I use via named pipes
"WriteFIle" to get excuted in another process
2) a pointer to a CWND * type object for which I do ::SendMessage(
of the responce of that command
I use SetEvent to trgger the Write file with the contents of what is in the buffer
In My case the CWnd * is a CDialog * but that shouldn't be a problem
The corruption ??? if I allocate via new in the ::INITINSTANCE of My Main Thread
that object (derived CEvent) it should remain there for the lifetime of the prrocess
I save the pointer to that object In My main thread reterive that pointer
via AfxGetApp
|
|
|
|
|
Very interesting but you need to show the exact code that causes the problem, including the code that creates any objects used in the line causing the problem. Explaining in broad terms as above does not really help.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
In My CWinApp:: InitInstance() I create a Derived CEventObject
mybaseeventptr = new MyBaseEvent(FALSE,FALSE,NULL,NULL); which has the following layout
class MyBaseEvent : public CEvent
{
public:
MyBaseEvent(); MyBaseEvent(BOOL own, BOOL reset, LPCTSTR mystring, LPSECURITY_ATTRIBUTES mysec);
char *buffer_ptr;
int len;
CWnd *send_window;
};
then further down in my CWInApp::InitInstance I create a worker thread which does
WriteFile and ReadFile (named pipes IPC)
this is triggered via SetEvent from my derived MyBaseEvent Object
In Addition to triggering the event I set the CWnd * pointer of the Window were I would like the message sent to
LRESULT CprogDebug::receive_tcpip(WPARAM mywparam,LPARAM mylparam) {
UNREFERENCED_PARAMETER(mywparam);
char *hold_ptr;
CHERC_CMDApp *main_app;
MyBaseEvent* myeventptr;
.
.
.
.
myeventptr->send_window = this;
myeventptr->SetEvent(); return TRUE;
}
The following is the worker thread I started which has the SendMessage causing the
exception
UINT hercgui_commands(LPVOID lparam)
{
int i;
CString storstrg;
BOOL bresult;
UNREFERENCED_PARAMETER(lparam);
void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName);
CMutex mymutex(FALSE,"HercLock",NULL);
CSingleLock HercLock(&mymutex);
DWORD dwbytestoread;
CHERC_CMDApp* main_app;
CMainFrame *main_window;
dwbytestoread = 1500;
MyBaseEvent *my_event;
main_app = (CHERC_CMDApp *)AfxGetApp();
my_event = main_app->mybaseeventptr;
SetThreadName(GetCurrentThreadId(),"HercGUI");
while(1)
{
WaitForSingleObject(my_event->m_hObject, INFINITE);
if (!HercLock.IsLocked())
{
HercLock.Lock(INFINITE);
WriteFile(main_app->filehdl,
(LPCVOID)my_event->buffer_ptr,
30,
NULL,
(LPOVERLAPPED) &main_app->herc_over);
}
bresult = ReadFile(main_app->filehdl,
(LPVOID) my_event->buffer_ptr,
dwbytestoread,
NULL,
(LPOVERLAPPED) &main_app->herc_over1);
WaitForSingleObject(main_app->herc_over1.hEvent,INFINITE);
HercLock.Unlock();
my_event->send_window->SendMessage(WM_HERCGUI_MESS,(WPARAM) my_event->len,(LPARAM) my_event->buffer_ptr);
i = 1;
}
return 0;
}
Maybe the problem is passing pointer objects across threads ?? as maybe I should just
pass the handle of the CWnd *
Thsnks
|
|
|
|
|
ForNow wrote: Maybe the problem is passing pointer objects across threads ? I think that is true, the SendMessage() function actually calls in to the window procedure of the main thread which is illegal. You should use the PostMessage() function which sends the message into the main thread's message queue.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Using Worker Threads[^]
From the following article seems like I can only Post/SendMessage from a Worker thread
only to the MainWindow CMainFrame not to a CDialog
|
|
|
|
|
Not true, I use PostMessage() to a CDialog based window all the time.
Note that SendMessage() cannot be used to send messages to controls that were *not* created by the thread sending the message. See my answer to This Question[^]
|
|
|
|
|
// What Causes a CInvalid Arg Exceptions ??
An invalid dialog's handle, for example
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Movies to Galaxy Tab 2-Play movies on Galaxy Tab 2 at Galaxy Tab 2 Column
Hot News! Click [b][url=http://www.pavtube.com/special-offer.html]Pavtube Special Offer - 25% Bundle Discount[/url][/b] page, you can get:
[b][url=http://www.pavtube.com/special-offer.html]25% OFF ByteCopy($ 42) + Blu- ray Video Converter Ultimate($ 65) = $80[/url][/b]
[b][url=http://www.pavtube.com/special-offer.html]25% OFF ChewTune($ 29) + Blu- ray Video Converter Ultimate($ 65) = $75[/url][/b]
[b][url=http://www.pavtube.com/special-offer.html]25% OFF ByteCopy($ 42) + Blu-ray Ripper($ 49) = $68[/url][/b]
......
[url=http://www.pavtube.com/special-offer.html][img]http://mts-to-aic-converter.com/wp-content/uploads/2012/07/pavtube-special-offer-bundle-discount.jpg[/img][/url]
Recently, Samsung released [b][url=http://www.foxreal.com/galaxy-tab.html]Galaxy Tab 2[/url][/b], it contains the 10.1 inch and 7.0 inch version. Both two are equipped with latest Android 4.0 OS, the greatest highlight of them is the update of display, no matter image, text, or videos, you will get unprecedented ultra-clear experience.
With the development of film industry, more and more movies shown to us in different forms. Such as Blu-ray, DVD, Digital Copy and more. The most common is Blu-ray or DVD discs, we often watch these disc movies at home via a hardware media player. Meanwhile, many movie files are called as digital copy movies. Like iTunes movies, amazon instant video, Blu-ray/DVD digital copies and movie files purchased from other online stores.
Today, this article is mainly talking about how to [b][url=http://www.foxreal.com/play-any-videos-on-galaxy-tab-2-7.0/]play multiple videos on Galaxy Tab 2[/url][/b]. At the same time, i also will show you the easiest way to get the best video quality on Galaxy Tab 2 10.1 or 7.0.
[img]http://www.foxreal.com/article-images/movies-for-galaxy-tab-2.jpg[/img]
At first, you should know, a video file contains many video parameters, like bitrate, frame rate, sample rate, resolution, video codec and more. Different video parameters will produce different video quality. By testing for many times, [b]Pavtube Studio[/b] designed the presets for Galaxy Tab 2. Which will give you the best video quality on no matter Galaxy Tab 2 10.1 or Galaxy Tab 2 7.0.
[b]For DVDs[/b], you should use Pavtube DVD Ripper as the [b][url=http://www.foxreal.com/convert-dvd-movies-for-galaxy-tab-2-10.1/]DVD to Galaxy Tab 2 converter[/url][/b] to rip and convert DVD movies for Galaxy Tab 2. If you have DVD ISO or IFO image files, you can also import it into this tool for handling.
[b]For Blu-ray movies[/b], just use Pavtube Blu-ray Ripper, the best[b] [url=http://www.pavtube.com/guide/put-play-1080p-bluray-on-galaxy-tab-2-101.html]Blu-ray to Galaxy Tab 2 converter[/url][/b] to convert Blu-ray videos for Galaxy Tab 2. It could deal with Blu-ray disc, Blu-ray ISO, DVD disc, DVD ISO or IFO files. As you see, this tool can help you handling both Blu-ray and DVD movies, but it's more expensive. If you have many Blu-ray and DVD discs, it's a good choice.
Want to [b]play iTunes, digital copy movies on Galaxy Tab 2[/b]. [b]Pavtube ChewTune[/b] could help you. Which is a professional [b][url=http://www.foxreal.com/transfer-itunes-movies-to-galaxy-tab-2-10.1/]DRM video converter[/url][/b]. With it, you can easily convert digital copy movies to Galaxy Tab 2 with few clicks.
Maybe now you have know the solution for common HD videos, yes, just with [b][url=http://www.foxreal.com/video-converter/]Galaxy Tab 2 video converter[/url][/b]. It supports a wide range of video formats, such as TiVo, VP6, MXF, VRO, MTS, M2TS, AVI, WMV, MKV, FLV, VOB, MVI, EVO, MOV, MPG, TOD and more.
Though they are different tools, the approximate operation of them is very similar. As follows:
Step 1. Run the [b][url=http://www.foxreal.com/video-converter/]Movies to Galaxy Tab 2 converter[/url][/b] tool ( according to your need, choose the right one). Import the video file you want to convert.
Step 2. Choose the presets for Galaxy Tab 2 10.1 or 7.0. As follows:
[b]For Galaxy Tab 2 10.1 users[/b], just Click on "Format" box, you will easily find the "Samsung Galaxy Tab 10.1 (*.mp4) ", under "Samsung" category. As follows
[img]http://www.foxreal.com/article-images/galaxy-tab-10.1-profile.png[/img]
By click on "Settings", you can see the full information of this profile:
[img]http://www.foxreal.com/article-images/Galaxy-tab-10.1-profile-settings.png[/img]
[b]For Galaxy Tab 2 7.0 users[/b], please choose " [b]Samsung Galaxy Tab H.264 ( *.mp4)[/b] ". By clicking " Settings" to get the details of this profile.
[img]http://www.foxreal.com/article-images/galaxy-tab-7.0-profile-settings.png[/img]
If you want to get higher video quality, you may adjust size, bitrate, frame rate etc to get what you want.
Step 3. Run the conversion.
When the conversion is done, you can transfer the video file to your Galaxy Tab 2 via USB cable. Then, Enjoy [b][url=http://www.foxreal.com/galaxy-tab.html]watching movies on Galaxy Tab 2[/url][/b].
Tip:
[b][url=http://www.pavtube.com/blu-ray-video-converter-ultimate/]Pavtube Blu-Ray Video Converter Ultimate[/url][/b] integrates a best bluray ripper, a DVD ripper,and a video converter together for you to rip Blu-ray discs, standard DVDs and convert almost all kinds of videos to universal video and audio file types with super fast conversion speed and excellent image and sound quality. It provides numerous optimized formats for a wide range of devices and programs, including Apple TV/Apple TV 2/[b][url=http://www.pavtube.com/apple-tv-3.html]Apple TV 3[/url][/b], Xbox 360, PS3, NAS , Home Theatre devices, WD TV, Popcorn Hour, PSP, [b][url=http://www.foxreal.com/convert-blu-ray-movies-for-google-nexus-7-playing/]Google Nexus 7[/url][/b], iPad/iPad 2/the [b][url=http://www.pavtube.com/guide/blu-ray-to-ipad-3-converter-for-mac.html]new iPad 3[/url][/b], [b][url=http://www.foxreal.com/galaxy-tab.html]Galaxy Tab 2[/url][/b], Xoom, [b][url=http://www.foxreal.com/galaxy-s2/]Galaxy S3[/url][/b], Toshiba Thrive, Transformer Prime, Motorola Droid (X), [b][url=http://www.pavtube.com/put-movies-to-ps-vita.html]Sony PS Vita[/url][/b], etc., so you can enjoy or edit your favorite Blu-ray movies, DVDs and SD/HD videos at will.
|
|
|
|
|
I have createed a dialog template resource, in the dialog editor I set the
WS_POPU P property.
It's fine to generate the modal dialog with the template resource.
Here is my problem: I want to change it's style from
WS_POPUP to
WS_CHILD since I want to generate the dialog in the property page(CPropertySheet).
I have tried many ways. Change the dialog in
OnInitDialog ,
OnCreate ,
PreCreateWindow ,
PreSubclassWindow with
ModifyStyle or
SetWindowLong doesn't work.
Now I wonder whether it's possible to generate the dialog with the same resource and modify the style.
Besides, the method list in Modifying a modal dialog's style and position at run time[^] doesn't work either.
Any help will be appreciate!
|
|
|
|
|
The article you linked to changes the style from WS_CHILD to WS_POPUP. It also suggests that it can not happen the other way around, that is from WS_POPUP to WS_CHILD. Are you sure you're making the same style change?
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Hi!
Can any one tell me how to solve this error?
C1900: Il mismatch between 'P1' version '20060201' and 'P2' version '20050411'
|
|
|
|
|
Which VS version you are using? Did you recently updated the VS ? If so, repairing the installation might work for you.
When I googled for more details, I found this[^].
|
|
|
|
|
Hi!
Installing the SP1 for Visual Studio 2005 fixed this error. Thank you.
|
|
|
|
|